forked from orbit-oss/flask
Convert Flask.run into a noop when run from the CLI
This commit is contained in:
parent
42fbbb4cbb
commit
c9b33d0e86
4 changed files with 30 additions and 0 deletions
|
|
@ -412,6 +412,13 @@ def run_command(info, host, port, reload, debugger, eager_loading,
|
|||
"""
|
||||
from werkzeug.serving import run_simple
|
||||
|
||||
# Set a global flag that indicates that we were invoked from the
|
||||
# command line interface provided server command. This is detected
|
||||
# by Flask.run to make the call into a no-op. This is necessary to
|
||||
# avoid ugly errors when the script that is loaded here also attempts
|
||||
# to start a server.
|
||||
os.environ['FLASK_RUN_FROM_CLI_SERVER'] = '1'
|
||||
|
||||
debug = get_debug_flag()
|
||||
if reload is None:
|
||||
reload = bool(debug)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue