Score:1

Supervisor not reloading Gunicorn properly with Django project

az flag

I am using Supervisor to reload Gunicorn when pushing Django project to production :

Workflow :

          " && python manage.py migrate"\
          " && python manage.py collectstatic --noinput"\
          " && supervisorctl restart frontdesk-gunicorn"\
          " && exit"

Supervisor config :

   [program:project-gunicorn]
    command=/home/gaetangr/project/myprojectenv/bin/gunicorn config.wsgi:application
    user = gaetangr
    directory = /home/gaetangr/project
    autostart = true
    autorestart = true

But most of the time, in order for all the change to propagate, I have to do a sudo :

systemctl restart gunicorn

From my understanding the command from supervisor should exactly the same.

Any idea ?

Score:0
jp flag

superviserd manages processes by creating subprocesses. If you start gunicorn with systemctl then superviserd won't know anything about this gunicorn and won't be able to restart it. Use only one process managment system - either supervisord or systemd.

az flag
Thanks, so the solution is to stop my service with Gunicorn and only use supervisor ? It is true that I use Gunicorn for one year and only recenlty start using supervisor.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.