Mercurial > piecrust2
comparison piecrust/serving/middlewares.py @ 917:33a89139c284
serve: Add `--admin` option to run the administration panel.
- Removed the `admin run` command.
- Cleaned up middlewares a bit.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Fri, 29 Sep 2017 08:42:38 -0700 |
parents | f070a4fc033c |
children | 8d5b8a3dca02 |
comparison
equal
deleted
inserted
replaced
916:84ce51430346 | 917:33a89139c284 |
---|---|
10 from piecrust.routing import RouteNotFoundError | 10 from piecrust.routing import RouteNotFoundError |
11 from piecrust.serving.util import ( | 11 from piecrust.serving.util import ( |
12 make_wrapped_file_response, get_requested_page, get_app_for_server) | 12 make_wrapped_file_response, get_requested_page, get_app_for_server) |
13 | 13 |
14 | 14 |
15 class StaticResourcesMiddleware(object): | 15 class PieCrustStaticResourcesMiddleware(object): |
16 """ WSGI middleware that serves static files from the `resources/server` | 16 """ WSGI middleware that serves static files from the `resources/server` |
17 directory in the PieCrust package. | 17 directory in the PieCrust package. |
18 """ | 18 """ |
19 def __init__(self, app): | 19 def __init__(self, app): |
20 self.app = app | 20 self.app = app |
36 | 36 |
37 return self.app(environ, start_response) | 37 return self.app(environ, start_response) |
38 | 38 |
39 | 39 |
40 class PieCrustDebugMiddleware(object): | 40 class PieCrustDebugMiddleware(object): |
41 """ WSGI middleware that handles debugging of PieCrust stuff. | 41 """ WSGI middleware that handles debugging of PieCrust stuff, and runs |
42 the asset pipeline in an SSE thread. | |
42 """ | 43 """ |
43 def __init__(self, app, appfactory, | 44 def __init__(self, app, appfactory, |
44 run_sse_check=None): | 45 run_sse_check=None): |
45 self.app = app | 46 self.app = app |
46 self.appfactory = appfactory | 47 self.appfactory = appfactory |