Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Jean-Francois Dockes
recoll-webui
Commits
a6318fae
Commit
a6318fae
authored
Dec 31, 2013
by
koniu
Browse files
py: add cli options for bind address/port
parent
699e7409
Changes
2
Hide whitespace changes
Inline
Side-by-side
README.rst
View file @
a6318fae
...
...
@@ -40,7 +40,11 @@ Run standalone
--------------
Run ``webui-standalone.py`` and connect to ``http://localhost:8080``.
To change the default port, edit ``webui-standalone.py``.
There's some optional command-line arguments available:::
-h, --help show this help message and exit
-a ADDR, --addr ADDR address to bind to [127.0.0.1]
-p PORT, --port PORT port to listen on [8080]
Run as WSGI/CGI
---------------
...
...
webui-standalone.py
View file @
a6318fae
#!/usr/bin/env python
import
os
import
argparse
import
webui
# handle command-line arguments
parser
=
argparse
.
ArgumentParser
()
parser
.
add_argument
(
'-a'
,
'--addr'
,
default
=
'127.0.0.1'
,
help
=
'address to bind to [127.0.0.1]'
)
parser
.
add_argument
(
'-p'
,
'--port'
,
default
=
'8080'
,
type
=
int
,
help
=
'port to listen on [8080]'
)
args
=
parser
.
parse_args
()
# change to webui's directory and import
os
.
chdir
(
os
.
path
.
dirname
(
__file__
))
import
webui
# set up webui and run in own http server
webui
.
bottle
.
debug
(
True
)
webui
.
bottle
.
run
(
host
=
'localhost'
,
port
=
8080
,
reloader
=
False
)
webui
.
bottle
.
run
(
host
=
args
.
addr
,
port
=
args
.
port
,
reloader
=
False
)
# vim: foldmethod=marker:filetype=python:textwidth=80:ts=4:et
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment