[Django]-Gunicorn status is active (exited) but showing not running in monit

3πŸ‘

βœ…

I just had the very same error message thrown at me (were you also following a Digital Ocean tutorial?) and spent quite a few hours trying to figure it out. I don’t know if you still need it, but perhaps I can spare someone else from wasting as much time as I did.

I managed to fix it (after several different attempts) by:

  1. Stopping gunicorn:

    sudo systemctl stop gunicorn

  2. Changing writing permissions in both directories containing gunicorn.service:

    sudo chmod u+x /etc/systemd/system/multi-user.target.wants/gunicorn-project.service

    sudo chmod u+x /etc/systemd/system/gunicorn-project.service

  3. Manually deleting and rebuilding the gunicorn-project.service symlink:

    unlink /etc/systemd/system/multi-user.target.wants/gunicorn-project.service

    rm /etc/systemd/system/multi-user.target.wants/gunicorn-project.service

    ln -s /etc/systemd/system/gunicorn-project.service /etc/systemd/system/multi-user.target.wants/gunicorn-project.service

  4. Reloading gunicorn daemon:

    sudo systemctl daemon-reload

  5. Restarting gunicorn:

    sudo systemctl start gunicorn

    sudo systemctl enable gunicorn

And the status changed to active (running). Basically, at some point, I installed gunicorn without setting proper permissions. Once I redid those steps with the right permissions, gunicorn was able to execute as intended.

OBS: my file was named gunicorn.service, which I believe is the default. I changed to gunicorn-project.service to match OP’s terminology.

πŸ‘€Ramon Melo

Leave a comment