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

Improve runserver command to work with reloader and debugger #313

Merged
merged 2 commits into from Jan 17, 2019

Conversation

alastair
Copy link
Collaborator

@alastair alastair commented Jan 6, 2019

The runserver command was broken by a flask upgrade in #308, causing
it to lose the app context when the reloader restarted the app.
Copy the flask.cli.run_command command to our manage.py so that it acts
like flask run, including the debugger and reloader behaviour.
Ensure that we also reload on changes to config.RELOAD_ON_FILES

Fixes AB-327

The runserver command was broken by a flask upgrade in #308, causing
it to lose the app context when the reloader restarted the app.
Copy the flask.cli.run_command command to our manage.py so that it acts
like `flask run`, including the debugger and reloader behaviour.
Ensure that we also reload on changes to config.RELOAD_ON_FILES

Fixes AB-327
app = flask.cli.DispatchingApp(info.load_app, use_eager_loading=eager_loading)
reload_on_files = info.load_app().config['RELOAD_ON_FILES']

from werkzeug.serving import run_simple
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we importing this here?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

because I copied this directly from the flask cli: https://github.com/pallets/flask/blob/a74864ec229141784374f1998324d2cbac837295/flask/cli.py#L782
Perhaps I should add a comment to this method saying where it comes from?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I already do in the docstring:

This is a copy of flask.cli.run_command

perhaps it can be more explicit with a github link

@alastair alastair merged commit 0db3d9c into master Jan 17, 2019
@alastair alastair deleted the fix-manage branch January 17, 2019 09:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants