Running django and gunicorn on raspberry pi
Solution 1:
OK, I've just been through setting up a Pi to serve my django app using the same instructions (I actually found your question before finding the digitalocean guide to follow, as I knew I didn't want 20.04/upstart).
Following the guide worked OK for me, so I'll try to help out. The things that I've noticed to look into are:
[Unit]
Description = gunicorn daemon
**Requires=gunicorn.socket**
After=network.target
[Service]
User=pi
WorkingDirectory=/home/pi/myvirtualenv_covid19/covid19
ExecStart=/home/pi/myvirtualenv_covid19/covid19env/bin/gunicorn --workers 3 --bind unix:/tmp/covid19.sock covid19.wsgi:application
Restart=always
[Install]
WantedBy=multi-user.target
I didn't have the requires=gunicorn.socket
in there in mine.
I put the socket file in my home directory for my user to avoid any permissions issues (I've had that be the issue before), so I'd recommend doing that.
AFAIK gunicorn communicates with nginx via the socket, so it doesn't need to be told a port to listen on - nginx does the listening and then passes that on to gunicorn.
I think you may need to check the logs, but I'd reckon it'd be between the extra line in the gunicorn.service file, and the location of the socket that would be the first place to start for me; with those things done (no reference, socket in home folder) I've got mine up and running without issue.
HTH