Search code examples
djangoubuntu-16.04uwsgisystemctl

Django - How to reload uwsgi in Ubuntu 16.04


I have a project running in Ubuntu 16.04 with uWSGI. There are times that I don't want to use restart command and just want to reload the project when I have changes.

When I was still using ubuntu 14.04, I can just use the following commands.

to reload:

sudo reload projectname

to restart

sudo restart projectname

now when I try to restart in Ubuntu 16.04

sudo systemctl restart uwsgi

When I try to reload using this command

sudo systemctl reload uwsgi

This is the error message

Failed to reload uwsgi.service: Job type reload is not applicable for unit uwsgi.service.

Screenshot of the error message.

enter image description here


Solution

  • It looks like you are running uwsgi in Emperor mode.

    That means that emperor process is governing its vassals (actual uwsgi processes that run your Django app) and it simply doesn't have reload job in its systemd unit.

    Instead you should try just touching the .ini file of your app.

    touch path/to/payroll.ini
    

    Below are couple of resources on Uwsgi, systemd and Emperor mode

    Systemd and Uwsgi

    Uwsgi Emperor Mode and Django