Python – how to do a graceful uwsgi reload via bash script

pythonuwsgi

I have a django application which is executing a bash script.
I require the nginx server to restart so I run /etc/init.d/nginx reload which works great. I have been using restart uwsgi for uwsgi but I need to do a graceful reload instead of a hard server restart.

How can I do this?


I am currently running a bash reload uwsgi function through subprocess.popen. It seems to be only reloading the process that is calling the subprocess not all sites being hosted by the uwsgi instance. importing uwsgi and running uwsgi.reload seems to also only effect the calling process. Is there a switch for either uwsgi through python or bash that allows restarting all uwsgi proces

Best Answer

You can do it in python

import uwsgi
uwsgi.reload()