# HG changeset patch # User Ludovic Chabant # Date 1539067316 25200 # Node ID f78ca60826ba2ba83ef20ce090be791e695ee8bf # Parent b5a780ac6c07673dc4f8072ae83265f13e2fa5b6 runserver: Fix auto-reloading of Jinja templates when running the dev server. diff -r b5a780ac6c07 -r f78ca60826ba wikked/commands/web.py --- a/wikked/commands/web.py Mon Oct 08 23:41:16 2018 -0700 +++ b/wikked/commands/web.py Mon Oct 08 23:41:56 2018 -0700 @@ -83,6 +83,13 @@ # Start with the Witch wiki parameters. wikked.settings.WIKI_FACTORY_PARAMETERS = ctx.params + # Set the debug mode for the Flask app. + # We can't wait until we call `app.run` to do this because it can + # create its Jinja environment before that, and so we would be missing + # the ability to edit view templates on the fly. + if ctx.args.dev: + wikked.settings.DEBUG = True + # Create/import the app. from wikked.web import app ctx.wiki.db.hookupWebApp(app) @@ -93,13 +100,8 @@ ctx.wiki.updateAll() # Run! - debug_mode = ctx.args.dev or app.config.get('DEBUG', False) - app.run( - host=ctx.args.host, - port=ctx.args.port, - debug=debug_mode, - use_debugger=debug_mode, - use_reloader=debug_mode) + app.run(host=ctx.args.host, + port=ctx.args.port) @register_command