Mercurial > piecrust2
diff 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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/piecrust/commands/builtin/serving.py Sun Aug 10 23:43:16 2014 -0700 @@ -0,0 +1,30 @@ +import logging +from piecrust.serving import Server +from piecrust.commands.base import ChefCommand + + +logger = logging.getLogger(__name__) + + +class ServeCommand(ChefCommand): + def __init__(self): + super(ServeCommand, self).__init__() + self.name = 'serve' + self.description = "Runs a local web server to serve your website." + + def setupParser(self, parser, app): + parser.add_argument('-p', '--port', + help="The port for the web server", + default=8080) + parser.add_argument('-a', '--address', + help="The host for the web server", + default='localhost') + + def run(self, ctx): + server = Server( + ctx.app.root_dir, + host=ctx.args.address, + port=ctx.args.port, + debug=ctx.args.debug) + server.run() +