L
L
lunrox2013-12-24 17:37:08
Django
lunrox, 2013-12-24 17:37:08

How to apply changes on django-server(ubuntu, nginx, uwsgi) without reboot?

Hello.
Faced such problem: for application of changes in the project it is necessary to reboot OS.
Server with ubuntu 12.04, nginx, uwsgi, python2.7, Django1.6
The following set of commands does not help:

sudo uwsgi --stop /path/to/uwsgi.ini
sudo service nginx restart
sudo uwsgi --ini /path/to/uwsgi.ini

Answer the question

In order to leave comments, you need to log in

4 answer(s)
A
alternativshik, 2013-12-24
@lunrox

man uwsgi touch-reload

U
un1t, 2013-12-25
@un1t

At least you can restart uwsgi
sudo service uwsgi restart

K
kesn, 2013-12-27
@kesn

For uwsgi - touch-reload, as already said.
After seeing the terrible sudo service nginx restart:
nginx beginners guide

S
Sergey Eremin, 2016-10-21
@Sergei_Erjemin

In the uwsgi.ini settings, you need to add the parameter touch-reload. It points to the name of the file, when it changes, the application auto-restarts. You can write a bash script that simply adds something like restart [current date and time] to this file and you get something like a django restart log.
In practice (at least for me), everything will auto-restart even if changes occur in any python-file of the project. I don't know why. The uwsgi.ini of the project contains:

touch-reload = /home/[user]/[адрес сайта]/logs/[адрес_сайта]_reload.log

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question