# HG changeset patch # User Ludovic Chabant # Date 1416983826 28800 # Node ID 50b65c700c96c950e8a73fc06db20aa9bd4f1d1d # Parent 742009d964ef3954a9e57d1c05b314677bb175b8 Don't use Werkzeug's reloader in non-debug mode unless we ask for it. diff -r 742009d964ef -r 50b65c700c96 piecrust/commands/builtin/serving.py --- a/piecrust/commands/builtin/serving.py Tue Nov 25 22:36:40 2014 -0800 +++ b/piecrust/commands/builtin/serving.py Tue Nov 25 22:37:06 2014 -0800 @@ -19,12 +19,16 @@ 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') def run(self, ctx): server = Server( ctx.app.root_dir, host=ctx.args.address, port=ctx.args.port, - debug=ctx.args.debug) + debug=ctx.args.debug, + use_reloader=ctx.args.use_reloader) server.run() diff -r 742009d964ef -r 50b65c700c96 piecrust/serving.py --- a/piecrust/serving.py Tue Nov 25 22:36:40 2014 -0800 +++ b/piecrust/serving.py Tue Nov 25 22:37:06 2014 -0800 @@ -53,12 +53,13 @@ class Server(object): def __init__(self, root_dir, host='localhost', port='8080', - debug=False, static_preview=True, + debug=False, use_reloader=False, static_preview=True, synchronous_asset_pipeline=True): self.root_dir = root_dir self.host = host self.port = port self.debug = debug + sefl.use_reloader = use_reloader or debug self.static_preview = static_preview self.synchronous_asset_pipeline = synchronous_asset_pipeline self._out_dir = None @@ -86,7 +87,7 @@ # Run the WSGI app. wsgi_wrapper = WsgiServer(self) run_simple(self.host, self.port, wsgi_wrapper, - use_debugger=True, use_reloader=True) + use_debugger=self.debug, use_reloader=self.debug) def _run_request(self, environ, start_response): try: