Search code examples
djangoservicesystemgunicorn

systemd service for Gunicorn for Django


I am using a vps with ubuntu 18.04 and I have created below systemd service for Gunicorn for my Django application with postgres as database :

[Unit]
Description=Gunicorn
After=network.target

[Service]
Type=simple
User=django
ExecStart=/bin/bash /home/django/bin/start-server.sh
Restart=on-failure

[Install]
WantedBy=multi-user.target

but after enabling gunicorn I have Server Error (500). And the error says:

OperationalError at / FATAL: Peer authentication failed for user "root"

what I have to do to make it right?


Solution

  • The problem was that the user of my ubuntu operating system was not the user I put in the service in the gunicorn.