view piecrust/admin/main.py @ 852:4850f8c21b6e

core: Start of the big refactor for PieCrust 3.0. * Everything is a `ContentSource`, including assets directories. * Most content sources are subclasses of the base file-system source. * A source is processed by a "pipeline", and there are 2 built-in pipelines, one for assets and one for pages. The asset pipeline is vaguely functional, but the page pipeline is completely broken right now. * Rewrite the baking process as just running appropriate pipelines on each content item. This should allow for better parallelization.
author Ludovic Chabant <ludovic@chabant.com>
date Wed, 17 May 2017 00:11:48 -0700
parents 5e91bc0e3b4d
children
line wrap: on
line source

import logging


logger = logging.getLogger(__name__)


def run_foodtruck(host=None, port=None, debug=False, extra_settings=None):
    es = {}
    if debug:
        es['DEBUG'] = True
    if extra_settings:
        es.update(extra_settings)

    from .web import create_foodtruck_app
    try:
        app = create_foodtruck_app(es)
        app.run(host=host, port=port, 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 . import pubutil
        logger.debug("Shutting down SSE generators from main...")
        pubutil.server_shutdown = True
        raise