Categories
Python Answers

How to auto reload Python Flask app upon code changes?

Spread the love

Sometimes, we want to auto reload Python Flask app upon code changes.

In this article, we’ll look at how to auto reload Python Flask app upon code changes.

How to auto reload Python Flask app upon code changes?

To auto reload Python Flask app upon code changes, we can enable debug mode.

To do this, we write

app.run(debug=True)

to call app.run with the debug argument set to True.

Also, from the shell, we can run

$ export FLASK_DEBUG=1
$ flask run

to set the FLASK_DEBUG environment variable to 1 to enable debug mode.

And then we run flask run to start the app.

Conclusion

To auto reload Python Flask app upon code changes, we can enable debug mode.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published.