Mercurial > piecrust2
view piecrust/commands/builtin/serving.py @ 196:154b8df04829
processing: Add Compass and Sass processors.
The Sass processor is similar to the Less processor, i.e. it tries to be
part of the structured pipeline processing by using the mapfile produced by
the Sass compiler in order to provide a list of dependencies.
The Compass processor is completely acting outside of the pipeline, so the
server won't know what's up to date and what's not. It's expected that the
user will run `compass watch` to keep things up to date. However, it will
require to pass the server's cache directory to put things in, so we'll need
to add some easy way to get that path for the user.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Sun, 11 Jan 2015 23:08:49 -0800 |
parents | f3aa511eef99 |
children | d7a548ebcd58 |
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') parser.add_argument('--use-reloader', help="Restart the server when PieCrust code changes", action='store_true') parser.add_argument('--use-debugger', help="Show the debugger when an error occurs", action='store_true') def run(self, ctx): server = Server( ctx.app.root_dir, host=ctx.args.address, port=ctx.args.port, debug=(ctx.args.debug or ctx.args.use_debugger), use_reloader=ctx.args.use_reloader) server.run()