I have set up uwsgi to serve django behind nginx. Then I change the database in django settings but uwsgi still shows the site with old database.
I also tried this suggestion and added
touch-reload = /etc/uwsgi/apps-available/django.ini
to the ini file. But after restarting uwsgi and touching django.ini
it still serves the old site. I tried to deactivate and reactivate virtualenv, no chance either. So really got confused and appreciate your hints.
Mandatory options. By default uWSGI does not enable threading support within the Python interpreter core. This means it is not possible to create background threads from Python code.
harakiri. A feature of uWSGI that aborts workers that are serving requests for an excessively long time. Configured using the harakiri family of options. Every request that will take longer than the seconds specified in the harakiri timeout will be dropped and the corresponding worker recycled.
From uWSGI docs about touch-reload: reload uWSGI if the specified file is modified/touched So if you want to reload on changes in settings.py, you should do:
touch-reload = /path/to/your/django-project/settings.py
Directive you've used before reloads uWSGI on any changes in uWSGI ini file.
FYI, of you need to restart uWSGI on changes in codebase also, you can use py-autoreload directive: http://uwsgi-docs.readthedocs.org/en/latest/Options.html#py-autoreload So you should have something like this in your uwsgi.ini
py-autoreload = 1
Note, these options aren't recommended for production. Good luck!
This is my uWSGI's configure file
wsgi-file = /home/www-data/djcode/metCCS/metCCS/nginx/wsgi.py
processer = 4
threads = 2
stats = 127.0.0.1:6000
enable-threads = true
master = true
harakiri = 30
socket = /usr/share/nginx/html/ng-sock/metCCS.sock
chmod-socket = 775
uid = www-data
gid = www-data
touch-reload = /home/www-data/djcode/metCCS/metCCS/settings.py
then, touch /home/www-data/djcode/metCCS/metCCS/settings.py
works fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With