Mercurial > piecrust2
comparison piecrust/commands/builtin/serving.py @ 3:f485ba500df3
Gigantic change to basically make PieCrust 2 vaguely functional.
- Serving works, with debug window.
- Baking works, multi-threading, with dependency handling.
- Various things not implemented yet.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 10 Aug 2014 23:43:16 -0700 |
parents | |
children | 50b65c700c96 |
comparison
equal
deleted
inserted
replaced
2:40fa08b261b9 | 3:f485ba500df3 |
---|---|
1 import logging | |
2 from piecrust.serving import Server | |
3 from piecrust.commands.base import ChefCommand | |
4 | |
5 | |
6 logger = logging.getLogger(__name__) | |
7 | |
8 | |
9 class ServeCommand(ChefCommand): | |
10 def __init__(self): | |
11 super(ServeCommand, self).__init__() | |
12 self.name = 'serve' | |
13 self.description = "Runs a local web server to serve your website." | |
14 | |
15 def setupParser(self, parser, app): | |
16 parser.add_argument('-p', '--port', | |
17 help="The port for the web server", | |
18 default=8080) | |
19 parser.add_argument('-a', '--address', | |
20 help="The host for the web server", | |
21 default='localhost') | |
22 | |
23 def run(self, ctx): | |
24 server = Server( | |
25 ctx.app.root_dir, | |
26 host=ctx.args.address, | |
27 port=ctx.args.port, | |
28 debug=ctx.args.debug) | |
29 server.run() | |
30 |