I am having an issue getting my gunicorn service to boot. I am working in digitalocean droplet. I have followed this tutorial and restarted twice: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04
I am using the droplet from the marketplace: Django by DigitalOcean
Version 2.2.12
OS Ubuntu 20.04
My gunicorn.service
file:
[Unit]
Description=Gunicorn daemon for Django Project
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/papayas/
ExecStart=/home/django/papayas/env/bin/gunicorn --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py config.wsgi:application
User=django
Group=django
[Install]
WantedBy=multi-user.target
the error when restarting gunicorn:
● gunicorn.service - Gunicorn daemon for Django Project
Loaded: loaded (/etc/systemd/system/gunicorn.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Sat 2021-01-23 11:50:27 UTC; 2s ago
Process: 16563 ExecStart=/home/django/papayas/env/bin/gunicorn --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py config.wsgi:application (code=exited, status=1/FAILURE)
Main PID: 16563 (code=exited, status=1/FAILURE)
DigitalOcean gives you a project that is working and that gunicorn.service is:
[Unit]
Description=Gunicorn daemon for Django Project
Before=nginx.service
After=network.target
[Service]
WorkingDirectory=/home/django/django_project
ExecStart=/usr/bin/gunicorn3 --name=django_project --pythonpath=/home/django/django_project --bind unix:/home/django/gunicorn.socket --config /etc/gunicorn.d/gunicorn.py django_project.wsgi:application
Restart=always
SyslogIdentifier=gunicorn
User=django
Group=django
[Install]
WantedBy=multi-user.target
I have been trying to fix this for days now. I don’t know what to do anymore. please help. I know it has something to do with the gunicorn exec. But I cannot seem to get it right.
This textbox defaults to using Markdown to format your answer.
You can type !ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
Managed to get it working by starting a blank Ubuntu droplet and installing everything from scratch.