Hot reload Flask app?

sjeik_appie at hotmail.com sjeik_appie at hotmail.com
Thu Oct 1 09:33:16 EDT 2020


   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


More information about the Python-list mailing list