New commandline options for debugging and specifying host/port of server to bind to, also added to readme.
parent
0919ac9d81
commit
cd04fb705f
|
@ -54,6 +54,12 @@ def main():
|
||||||
help="Slice the given files instead of opening them in Cura")
|
help="Slice the given files instead of opening them in Cura")
|
||||||
parser.add_option("-w", "--web", action="store_true", dest="webui",
|
parser.add_option("-w", "--web", action="store_true", dest="webui",
|
||||||
help="Start the webui instead of the normal Cura UI")
|
help="Start the webui instead of the normal Cura UI")
|
||||||
|
parser.add_option("-d", "--debug", action="store_true", dest="debug",
|
||||||
|
help="Enable debug mode, currently only used by the webui")
|
||||||
|
parser.add_option("--web-host", action="store", type="string", default="0.0.0.0", dest="webHost",
|
||||||
|
help="Specify the host on which to bind the webui, defaults to 0.0.0.0 (all interfaces) if not set")
|
||||||
|
parser.add_option("--web-port", action="store", type="int", default=5000, dest="webPort",
|
||||||
|
help="Specify the port on which to bind the webui, defaults to 5000 if not set")
|
||||||
(options, args) = parser.parse_args()
|
(options, args) = parser.parse_args()
|
||||||
|
|
||||||
if options.profile is not None:
|
if options.profile is not None:
|
||||||
|
@ -69,7 +75,7 @@ def main():
|
||||||
sliceRun.runSlice(args)
|
sliceRun.runSlice(args)
|
||||||
elif options.webui:
|
elif options.webui:
|
||||||
import Cura.webui as webapp
|
import Cura.webui as webapp
|
||||||
webapp.run()
|
webapp.run(host=options.webHost, port=options.webPort, debug=options.debug)
|
||||||
else:
|
else:
|
||||||
#Place any unused arguments as last file, so Cura starts with opening those files.
|
#Place any unused arguments as last file, so Cura starts with opening those files.
|
||||||
if len(args) > 0:
|
if len(args) > 0:
|
||||||
|
|
|
@ -236,5 +236,6 @@ def sizeof_fmt(num):
|
||||||
def allowed_file(filename):
|
def allowed_file(filename):
|
||||||
return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS
|
return "." in filename and filename.rsplit(".", 1)[1] in ALLOWED_EXTENSIONS
|
||||||
|
|
||||||
def run():
|
def run(host = "0.0.0.0", port = 5000, debug = False):
|
||||||
app.run(host="0.0.0.0", port=5000)
|
app.debug = debug
|
||||||
|
app.run(host=host, port=port, use_reloader=False)
|
||||||
|
|
|
@ -91,6 +91,8 @@ This fork of Cura includes a WebUI for remote printing via the browser. It depen
|
||||||
its dependencies "werkzeug", "jinja2" and "itsdangerous", so you'll need those in order to run the WebUI. A simple
|
its dependencies "werkzeug", "jinja2" and "itsdangerous", so you'll need those in order to run the WebUI. A simple
|
||||||
`pip install -r requirements.txt` or `pip install flask` should take care of that.
|
`pip install -r requirements.txt` or `pip install flask` should take care of that.
|
||||||
|
|
||||||
Once installed, you can startup the WebUI instead of the regular Cura UI via the command-line option `--web` or `-w`. The
|
Once installed, you can startup the WebUI instead of the regular Cura UI via the command-line option `--web` or `-w`. By
|
||||||
web interface will then be available on port 5000. If you want to change that (or the IP address the server binds to,
|
default the web interface will bind to all interfaces on port 5000 (so pointing your browser to `http://127.0.0.1:5000`
|
||||||
which currently is `0.0.0.0`), please take a look at the source code of `Cura/webui/__init__.py`.
|
will do the trick). If you want to change that, use the additional command line parameters `web-host` and `web-port`,
|
||||||
|
which accept the host ip to bind to and the numeric port number respectively. If for example you want to the server
|
||||||
|
to only listen on the local interface on port 8080, the command line would be `--web --web-host=127.0.0.1 --web-port=8080`.
|
Loading…
Reference in New Issue