Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serve should watch for changes and autorestart #8

Closed
honzajavorek opened this issue Feb 4, 2017 · 3 comments
Closed

Serve should watch for changes and autorestart #8

honzajavorek opened this issue Feb 4, 2017 · 3 comments

Comments

@honzajavorek
Copy link
Member

It's really poor developer experience to have to restart it manually.

@encukou
Copy link
Member

encukou commented Feb 4, 2017

You need to set app.config['TEMPLATES_AUTO_RELOAD'] = True, as in any Flask app.

The problem is that you need to set it before the Jinja environment is created, and helpers like @app.template_filter create the env.

Elsa does (try to) set the config variable. But by the time Elsa has a chance run, it may be too late for it to have any effect.

@encukou
Copy link
Member

encukou commented Feb 4, 2017

Don't know how to fix this properly. Perhaps making people use from elsa import make_app instead of from flask import Flask? (cc @hroncok)

sairon added a commit to sairon/elsa that referenced this issue Feb 4, 2017
Auto reloading does not work correctly when Jinja environment is
initialized before elsa's cli() is called (for example when adding
template filters - see pyvec#8). Flask's TEMPLATES_AUTO_RELOAD normally
propagates to auto_reload property of Jinja's environment which can
be set in runtime, so try to keep this behaviour in elsa's serve mode.

Fixes pyvec#8.
encukou pushed a commit to encukou/elsa that referenced this issue Feb 5, 2017
Auto reloading does not work correctly when Jinja environment is
initialized before elsa's cli() is called (for example when adding
template filters - see pyvec#8). Flask's TEMPLATES_AUTO_RELOAD normally
propagates to auto_reload property of Jinja's environment which can
be set in runtime, so try to keep this behaviour in elsa's serve mode.

Fixes pyvec#8
Fixes pyvec#9
@encukou
Copy link
Member

encukou commented Feb 5, 2017

This is reported in Flask: pallets/flask#1907

@encukou encukou closed this as completed in 0fda883 Feb 6, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants