Fix werkzeug instance was created twice in Debug Mode (#2135) (#2136)

* Fix werkzeug instance was created twice in Debug Mode (#2135)

* add reloader option for flask (#2136)

* using --no-reload option for flask

* divide a line of code into two lines for PEP8
This commit is contained in:
Benedict Jin
2017-02-14 13:33:59 +08:00
committed by Maxime Beauchemin
parent 2f05efaf12
commit a5a931a670
2 changed files with 12 additions and 6 deletions

View File

@@ -30,6 +30,10 @@ def init():
@manager.option(
'-d', '--debug', action='store_true',
help="Start the web server in debug mode")
@manager.option(
'-n', '--no-reload', action='store_false', dest='no_reload',
default=config.get("FLASK_USE_RELOAD"),
help="Don't use the reloader in debug mode")
@manager.option(
'-a', '--address', default=config.get("SUPERSET_WEBSERVER_ADDRESS"),
help="Specify the address to which to bind the web server")
@@ -42,7 +46,7 @@ def init():
@manager.option(
'-t', '--timeout', default=config.get("SUPERSET_WEBSERVER_TIMEOUT"),
help="Specify the timeout (seconds) for the gunicorn web server")
def runserver(debug, address, port, timeout, workers):
def runserver(debug, no_reload, address, port, timeout, workers):
"""Starts a Superset web server"""
debug = debug or config.get("DEBUG")
if debug:
@@ -50,7 +54,8 @@ def runserver(debug, address, port, timeout, workers):
host='0.0.0.0',
port=int(port),
threaded=True,
debug=True)
debug=True,
use_reloader=no_reload)
else:
cmd = (
"gunicorn "
@@ -117,13 +122,13 @@ def load_examples(load_test_data):
@manager.option(
'-d', '--datasource',
help=(
"Specify which datasource name to load, if omitted, all "
"datasources will be refreshed"))
"Specify which datasource name to load, if omitted, all "
"datasources will be refreshed"))
@manager.option(
'-m', '--merge',
help=(
"Specify using 'merge' property during operation. "
"Default value is False "))
"Specify using 'merge' property during operation. "
"Default value is False "))
def refresh_druid(datasource, merge):
"""Refresh druid datasources"""
session = db.session()