I'm currently developing an application in Amazon Linux2
using Django
, Nginx
, Gunicorn
, and Postgresql
.
I have created and configured a system file for Gunicorn
to work when the OS boots, But after starting gunicorn
I get the following error...
Jun 08 18:18:04 ip-172-31-16-86.us-east-2.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:10] Executable path is not absolute, ignoring: gunicorn --access-logfile - --workers 3 --bind unix:/home/myname/django_project/django_project.sock ......
Jun 08 18:18:04 ip-172-31-16-86.us-east-2.compute.internal systemd[1]: gunicorn.service lacks both ExecStart= and ExecStop= setting. Refusing.
I'm sure the absolute path specified in the file is correct, but I get the error.
How could I solve this problem?
*NOTE:
Amazon Linux2
doesn't include www-data
groups, so I created using groupadd
command.
gunicorn.service
[Unit]
Description=gunicorn daemon
After=network.target
[Service]
User=myname
Group=www-data
WorkingDirectory=/home/myname/django_project
ExecStart=/home/myname/venv/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/myname/django_project/django_project.sock django_project.wsgi:application
[Install]
WantedBy=multi-user.target
Directory structure
home
│
└─myname
│
├─django_project
│ ├─django_project
│ ├─manage.py
│ └─django_project.sock
│
└─venv
└─bin
└─gunicorn
OS Amazon Linux2
gunicorn 20.1.0
boto 2.49.0
Django 3.2.4
django-ses 2.0.0