Mercurial > piecrust2
comparison piecrust/admin/main.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(__name__) | |
5 | |
6 | |
7 def run_foodtruck(host=None, port=None, debug=False, extra_settings=None): | |
8 es = {} | |
9 if debug: | |
10 es['DEBUG'] = True | |
11 if extra_settings: | |
12 es.update(extra_settings) | |
13 | |
14 from .web import create_foodtruck_app | |
15 try: | |
16 app = create_foodtruck_app(es) | |
17 app.run(host=host, port=port, debug=debug, threaded=True) | |
18 except SystemExit: | |
19 # This is needed for Werkzeug's code reloader to be able to correctly | |
20 # shutdown the child process in order to restart it (otherwise, SSE | |
21 # generators will keep it alive). | |
22 from . import pubutil | |
23 logger.debug("Shutting down SSE generators from main...") | |
24 pubutil.server_shutdown = True | |
25 raise | |
26 |