view piecrust/admin/wsgiutil.py @ 853:f070a4fc033c

core: Continue PieCrust3 refactor, simplify pages. The asset pipeline is still the only function pipeline at this point. * No more `QualifiedPage`, and several other pieces of code deleted. * Data providers are simpler and more focused. For instance, the page iterator doesn't try to support other types of items. * Route parameters are proper known source metadata to remove the confusion between the two. * Make the baker and pipeline more correctly manage records and record histories. * Add support for record collapsing and deleting stale outputs in the asset pipeline.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 21 May 2017 00:06:59 -0700
parents 5e91bc0e3b4d
children
line wrap: on
line source

import logging


logger = logging.getLogger()


def get_wsgi_app(admin_root=None, log_file=None,
                 max_log_bytes=4096, log_backup_count=0,
                 log_level=logging.INFO):
    if log_file:
        from logging.handlers import RotatingFileHandler
        handler = RotatingFileHandler(log_file, maxBytes=max_log_bytes,
                                      backupCount=log_backup_count)
        handler.setLevel(log_level)
        logging.getLogger().addHandler(handler)

    logger.debug("Creating WSGI application.")
    es = {}
    if admin_root:
        es['FOODTRUCK_ROOT'] = admin_root
    from .web import create_foodtruck_app
    app = create_foodtruck_app(es)
    return app