2👍
The following snippet will use Django’s autoreloader to detect code changes, and hook into uWSGI to reload the code whenever necessary:
import uwsgi
from uwsgidecorators import timer
from django.utils import autoreload
@timer(3)
def change_code_gracefull_reload(sig):
if autoreload.code_changed():
uwsgi.reload()
You can put this code in your wsgi.py
file before get_wsgi_application()
. The decorator will register the function to be run every 3 seconds by uWSGI.
👤knbk
0👍
–touch-reload
As I known this arg is used for a specific configuration .ini
file.
Please try with option --py-autoreload 1
.
At development phase, I think you can use Nginx proxy directly to default runserver
or runserver_plus
(please check django-extensions
)
Source:stackexchange.com