comparison piecrust/commands/builtin/serving.py @ 371:c2ca72fb7f0b 2.0.0a8

caching: Use separate caches for config variants and other contexts. * The `_cache` directory is now organized in multiple "sub-caches" for different contexts. * A new context is created when config variants or overrides are applied. * `serve` context uses a different context that the other commends, to prevent the `bake` command's output from messing up the preview server (e.g. with how asset URLs are generated differently between the two). * Fix a few places where the cache directory was referenced directly.
author Ludovic Chabant <ludovic@chabant.com>
date Sun, 03 May 2015 23:59:46 -0700
parents 4f00bb99400e
children fa3ee8a8ee2d
comparison
equal deleted inserted replaced
370:a1bbe66cba03 371:c2ca72fb7f0b
9 class ServeCommand(ChefCommand): 9 class ServeCommand(ChefCommand):
10 def __init__(self): 10 def __init__(self):
11 super(ServeCommand, self).__init__() 11 super(ServeCommand, self).__init__()
12 self.name = 'serve' 12 self.name = 'serve'
13 self.description = "Runs a local web server to serve your website." 13 self.description = "Runs a local web server to serve your website."
14 self.cache_name = 'server'
14 15
15 def setupParser(self, parser, app): 16 def setupParser(self, parser, app):
16 parser.add_argument( 17 parser.add_argument(
17 '-p', '--port', 18 '-p', '--port',
18 help="The port for the web server", 19 help="The port for the web server",
41 debug = ctx.args.debug or ctx.args.use_debugger 42 debug = ctx.args.debug or ctx.args.use_debugger
42 43
43 server = Server( 44 server = Server(
44 ctx.app.root_dir, 45 ctx.app.root_dir,
45 debug=debug, 46 debug=debug,
47 sub_cache_dir=ctx.app.sub_cache_dir,
46 use_reloader=ctx.args.use_reloader) 48 use_reloader=ctx.args.use_reloader)
47 app = server.getWsgiApp() 49 app = server.getWsgiApp()
48 50
49 if ctx.args.wsgi == 'werkzeug': 51 if ctx.args.wsgi == 'werkzeug':
50 from werkzeug.serving import run_simple 52 from werkzeug.serving import run_simple