danywigglebutt
danywigglebutt

Reputation: 269

Apply Flask changes to Apache2 server without restart

Everytime I make a change to Flask in any .py file on my Apache2 server, the changes don't go into effect until I run sudo service apache2 restart.

This was fine when I only had one application on the server but now I have a couple and I'd like to avoid restarting the entire server whenever I want to make a Flask change.

Any suggestions?

Upvotes: 1

Views: 2154

Answers (2)

Graham Dumpleton
Graham Dumpleton

Reputation: 58523

Don't do development in your main Apache. Presuming you are using mod_wsgi, use mod_wsgi-express instead and run a separate instance from the command line during development. There is even an option on mod_wsgi-express to auto reload processes when your code changes. See:

Upvotes: 0

danywigglebutt
danywigglebutt

Reputation: 269

Thanks @AllinOne: graceful restart of apache where traffic wont be impacted, using

apachectl -k graceful

Upvotes: 4

Related Questions