Mercurial > piecrust2
annotate piecrust/admin/main.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 |
rev | line source |
---|---|
778
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
1 import logging |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
2 |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
3 |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
4 logger = logging.getLogger(__name__) |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
5 |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
6 |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
7 def run_foodtruck(host=None, port=None, debug=False, extra_settings=None): |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
8 es = {} |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
9 if debug: |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
10 es['DEBUG'] = True |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
11 if extra_settings: |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
12 es.update(extra_settings) |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
13 |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
14 from .web import create_foodtruck_app |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
15 try: |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
16 app = create_foodtruck_app(es) |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
17 app.run(host=host, port=port, debug=debug, threaded=True) |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
18 except SystemExit: |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
19 # This is needed for Werkzeug's code reloader to be able to correctly |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
20 # shutdown the child process in order to restart it (otherwise, SSE |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
21 # generators will keep it alive). |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
22 from . import pubutil |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
23 logger.debug("Shutting down SSE generators from main...") |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
24 pubutil.server_shutdown = True |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
25 raise |
5e91bc0e3b4d
internal: Move admin panel code into the piecrust package.
Ludovic Chabant <ludovic@chabant.com>
parents:
diff
changeset
|
26 |