Hot reload Flask app?
Roland Müller
roland.em0001 at googlemail.com
Thu Oct 1 11:58:20 EDT 2020
On 2020-10-01 16:33, sjeik_appie at hotmail.com wrote:
> Hi,
> I would like to create a "/reload" view in my Flask app, so I could easily
> and safely reload it when code, templates etc change. Similar to what
> happens when running the app with the debug server. I am using Nginx and
> Gevent on a recent Ubuntu system with Python 3.6.
> My strategy would be to gracefully stop Gevent [1], then do
> os.kill(os.getpid(), signal.SIGHUP). I have not yet tried this (not
> working today!). Just wondering if there are best practices.
> Thanks!
> Albert-Jan
> [1]
> http://www.gevent.org/api/gevent.baseserver.html#gevent.baseserver.BaseServer.stop
Running flask app.run(debug=True) will make the Flask server watching
the filesystem for source code changes and re-deploy your app.
https://pythonhosted.org/Flask-Debug/
-Roland
More information about the Python-list
mailing list