Browse Source

Enable applications to start the debugger

pull/1640/head
Nick Zaccardi 9 years ago
parent
commit
eb001bf6de
  1. 13
      flask/cli.py

13
flask/cli.py

@ -105,6 +105,15 @@ class DispatchingApp(object):
of the Werkzeug debugger means that it shows up in the browser.
"""
@property
def debug(self):
try:
return self._app.debug
except AttributeError as e:
print('Application not created yet, can\'t determine debug '
'status.')
return False
def __init__(self, loader, use_eager_loading=False):
self.loader = loader
self._app = None
@ -421,6 +430,10 @@ def run_command(info, host, port, reload, debugger, eager_loading,
if info.debug is not None:
print(' * Forcing debug %s' % (info.debug and 'on' or 'off'))
if app.debug:
debugger = True
print(' * Debug activated by application configuration.')
run_simple(host, port, app, use_reloader=reload,
use_debugger=debugger, threaded=with_threads)

Loading…
Cancel
Save