Mercurial > piecrust2
view foodtruck/main.py @ 599:d7baac1d01e6
admin: Set the `DEBUG` flag before the app runs so we can read it during setup.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 24 Jan 2016 10:40:55 -0800 |
parents | b884bef3e611 |
children | c6bc0ef03f82 |
line wrap: on
line source
import logging logger = logging.getLogger(__name__) def run_foodtruck(debug=False): if debug: import foodtruck.settings foodtruck.settings.DEBUG = debug from .web import app try: app.run(debug=debug, threaded=True) except SystemExit: # This is needed for Werkzeug's code reloader to be able to correctly # shutdown the child process in order to restart it (otherwise, SSE # generators will keep it alive). from .views import baking logger.debug("Shutting down SSE generators from main...") baking.server_shutdown = True raise