Mercurial > piecrust2
comparison piecrust/serving/server.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 | fddaf43424e2 |
children | b447c24bc8d4 |
comparison
equal
deleted
inserted
replaced
916:84ce51430346 | 917:33a89139c284 |
---|---|
19 | 19 |
20 | 20 |
21 logger = logging.getLogger(__name__) | 21 logger = logging.getLogger(__name__) |
22 | 22 |
23 | 23 |
24 class WsgiServer(object): | 24 class PieCrustServer(object): |
25 """ A WSGI application that serves a PieCrust website. | 25 """ A WSGI application that serves a PieCrust website. |
26 """ | 26 """ |
27 def __init__(self, appfactory, **kwargs): | 27 def __init__(self, appfactory, **kwargs): |
28 self.server = Server(appfactory, **kwargs) | 28 self.server = _ServerImpl(appfactory, **kwargs) |
29 | 29 |
30 def __call__(self, environ, start_response): | 30 def __call__(self, environ, start_response): |
31 return self.server._run_request(environ, start_response) | 31 return self.server._run_request(environ, start_response) |
32 | 32 |
33 | 33 |
50 desc += '<li>' + escape(str(nfe)) + '</li>' | 50 desc += '<li>' + escape(str(nfe)) + '</li>' |
51 desc += '</p>' | 51 desc += '</p>' |
52 return desc | 52 return desc |
53 | 53 |
54 | 54 |
55 class Server(object): | 55 class _ServerImpl(object): |
56 """ The PieCrust server. | 56 """ The PieCrust server. |
57 """ | 57 """ |
58 def __init__(self, appfactory, | 58 def __init__(self, appfactory, |
59 enable_debug_info=True, | 59 enable_debug_info=True, |
60 root_url='/', | 60 root_url='/', |