|
|
@ -899,12 +899,28 @@ class Flask(_PackageBoundObject): |
|
|
|
The default port is now picked from the ``SERVER_NAME`` |
|
|
|
The default port is now picked from the ``SERVER_NAME`` |
|
|
|
variable. |
|
|
|
variable. |
|
|
|
""" |
|
|
|
""" |
|
|
|
|
|
|
|
# determine if this method is being invoked in the standard way (from |
|
|
|
|
|
|
|
# the global scope of the __main__ module) by checking the length of |
|
|
|
|
|
|
|
# the call stack |
|
|
|
|
|
|
|
from inspect import stack |
|
|
|
|
|
|
|
called_from_main = len(stack()) == 2 |
|
|
|
|
|
|
|
|
|
|
|
# Change this into a no-op if the server is invoked from the |
|
|
|
# Change this into a no-op if the server is invoked from the |
|
|
|
# command line. Have a look at cli.py for more information. |
|
|
|
# command line. Have a look at cli.py for more information. |
|
|
|
if os.environ.get('FLASK_RUN_FROM_CLI') == 'true': |
|
|
|
if called_from_main: |
|
|
|
from .debughelpers import explain_ignored_app_run |
|
|
|
if os.environ.get('FLASK_RUN_FROM_CLI') == 'true': |
|
|
|
explain_ignored_app_run() |
|
|
|
if os.environ.get('FLASK_RUN_FROM_APP_RUN') != 'true': |
|
|
|
return |
|
|
|
from .debughelpers import explain_ignored_app_run |
|
|
|
|
|
|
|
explain_ignored_app_run() |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if load_dotenv and not options: |
|
|
|
|
|
|
|
# Since this is a call with no custom settings besides host, |
|
|
|
|
|
|
|
# port and debug, we can attempt to route it through the cli |
|
|
|
|
|
|
|
# runner, and only fall back to the implementation in this |
|
|
|
|
|
|
|
# function if that does not work |
|
|
|
|
|
|
|
if cli.run_from_app_run(self, host, port, debug): |
|
|
|
|
|
|
|
return |
|
|
|
|
|
|
|
|
|
|
|
if get_load_dotenv(load_dotenv): |
|
|
|
if get_load_dotenv(load_dotenv): |
|
|
|
cli.load_dotenv() |
|
|
|
cli.load_dotenv() |
|
|
|