Mercurial > wikked
changeset 469:f78ca60826ba
runserver: Fix auto-reloading of Jinja templates when running the dev server.
author | Ludovic Chabant <ludovic@chabant.com> |
---|---|
date | Mon, 08 Oct 2018 23:41:56 -0700 |
parents | b5a780ac6c07 |
children | 385de1daefb3 |
files | wikked/commands/web.py |
diffstat | 1 files changed, 9 insertions(+), 7 deletions(-) [+] |
line wrap: on
line diff
--- 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