Skip to content

Commit

Permalink
Fix werkzeug instance was created twice in Debug Mode (#2135) (#2136)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
asdf2014 authored and mistercrunch committed Feb 14, 2017
1 parent 2f05efa commit a5a931a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
17 changes: 11 additions & 6 deletions superset/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand All @@ -42,15 +46,16 @@ 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:
app.run(
host='0.0.0.0',
port=int(port),
threaded=True,
debug=True)
debug=True,
use_reloader=no_reload)
else:
cmd = (
"gunicorn "
Expand Down Expand Up @@ -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()
Expand Down
1 change: 1 addition & 0 deletions superset/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@

# Whether to run the web server in debug mode or not
DEBUG = False
FLASK_USE_RELOAD = True

# Whether to show the stacktrace on 500 error
SHOW_STACKTRACE = True
Expand Down

0 comments on commit a5a931a

Please sign in to comment.