Mercurial > piecrust2
view piecrust/commands/builtin/serving.py @ 111:208c652551a3
Quick fix for making the server correctly update referenced pages.
Disable the file-system cache for rendered segments when in server mode. We
can bring this optimization back when we're actually using the baking record
in the server too in order to know dependencies.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Thu, 16 Oct 2014 17:03:42 -0700 |
parents | f485ba500df3 |
children | 50b65c700c96 |
line wrap: on
line source
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()