Im trying to deploy my Django app in a linux server by following this tutorial https://www.digitalocean.com/community/tutorials/como-configurar-django-con-postgres-nginx-y-gunicorn-en-ubuntu-18-04-es
but keep getting an error when trying to set gunicorn with my django project
● gunicorn.service - gunicorn daemon
Loaded: loaded (/etc/systemd/system/gunicorn.service; disabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Thu 2021-02-04 17:45:34 +01; 25min ago
TriggeredBy: ● gunicorn.socket
Main PID: 754981 (code=exited, status=217/USER)
Feb 04 17:45:34 vps141106 systemd[1]: Started gunicorn daemon.
Feb 04 17:45:34 vps141106 systemd[754981]: gunicorn.service: Failed to determine user credentials: No such process
Feb 04 17:45:34 vps141106 systemd[754981]: gunicorn.service: Failed at step USER spawning /home/root/venv/bin/gunicorn: No such process
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Main process exited, code=exited, status=217/USER
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Start request repeated too quickly.
Feb 04 17:45:34 vps141106 systemd[1]: gunicorn.service: Failed with result 'exit-code'.
Feb 04 17:45:34 vps141106 systemd[1]: Failed to start gunicorn daemon.
This is my service
[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target
[Service]
User=root
Group=www-data
WorkingDirectory=/home/root/test
ExecStart=/home/root/venv/bin/gunicorn
--access-logfile -
--workers 3
--bind unix:/run/gunicorn.sock
test.wsgi:application
[Install]
WantedBy=multi-user.target
Im getting those errors
gunicorn.service: Failed to determine user credentials: No such process
gunicorn.service: Failed at step USER spawning /home/root/venv/bin/gunicorn: No such process
Now Im pretty sure I have something in /home/root/venv/bin/gunicorn I just did a
nano /home/root/venv/bin/gunicorn and got this
GNU nano 4.8 /home/root/venv/bin/gunicorn
#!/home/root/venv/bin/python
# -*- coding: utf-8 -*-
import re
import sys
from gunicorn.app.wsgiapp import run
if __name__ == '__main__':
sys.argv[0] = re.sub(r'(-script.pyw|.exe)?$', '', sys.argv[0])
sys.exit(run())
of course just in case I did "pip install gunicorn" inside my venv and it is in fact installed
now with the first error, Im not sure what is causing it, the system user is called root and has sudo privileges, maybe I need to put the password somewhere to make sure it can login?
I hope you guys can help me.
question from:
https://stackoverflow.com/questions/66061229/error-deploying-a-django-app-using-gunicorn 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…