Mercurial > piecrust2
comparison piecrust/admin/wsgiutil.py @ 778:5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sat, 16 Jul 2016 15:02:24 +0200 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
777:8d633ca59bc5 | 778:5e91bc0e3b4d |
---|---|
1 import logging | |
2 | |
3 | |
4 logger = logging.getLogger() | |
5 | |
6 | |
7 def get_wsgi_app(admin_root=None, log_file=None, | |
8 max_log_bytes=4096, log_backup_count=0, | |
9 log_level=logging.INFO): | |
10 if log_file: | |
11 from logging.handlers import RotatingFileHandler | |
12 handler = RotatingFileHandler(log_file, maxBytes=max_log_bytes, | |
13 backupCount=log_backup_count) | |
14 handler.setLevel(log_level) | |
15 logging.getLogger().addHandler(handler) | |
16 | |
17 logger.debug("Creating WSGI application.") | |
18 es = {} | |
19 if admin_root: | |
20 es['FOODTRUCK_ROOT'] = admin_root | |
21 from .web import create_foodtruck_app | |
22 app = create_foodtruck_app(es) | |
23 return app | |
24 |