view foodtruck/main.py @ 588:b884bef3e611

admin: New `admin` command to manage FoodTruck-related things. Remove old FoodTruck command and packaging.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 17 Jan 2016 21:44:41 -0800
parents d4a01a023998
children d7baac1d01e6
line wrap: on
line source

import logging


logger = logging.getLogger(__name__)


def run_foodtruck(debug=False):
    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