gunicorn autoreload on source change


Question

Finally I migrated my development env from runserver to gunicorn/nginx.

It'd be convenient to replicate the autoreload feature of runserver to gunicorn, so the server automatically restarts when source changes. Otherwise I have to restart the server manually with kill -HUP.

Any way to avoid the manual restart?

1
104
10/8/2012 9:53:22 AM

Accepted Answer

While this is old question, just for consistency - since version 19.0 gunicorn has --reload option. So no third party tools needed more.

204
7/22/2014 5:51:06 PM

One option would be to use the --max-requests to limit each spawned process to serving only one request by adding --max-requests 1 to the startup options. Every newly spawned process should see your code changes and in a development environment the extra startup time per request should be negligible.


Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon