【发布时间】:2023-03-30 08:01:01
【问题描述】:
我目前正在使用Django、Nginx、Gunicorn 和Postgresql 在Amazon Linux2 中开发应用程序。
我已经为Gunicorn 创建并配置了一个系统文件,以便在操作系统启动时工作,但是在启动gunicorn 后,我收到以下错误...
6 月 8 日 18:18:04 ip-172-31-16-86.us-east-2.compute.internal systemd[1]: [/etc/systemd/system/gunicorn.service:10] 可执行路径不是 绝对的,忽略:gunicorn --access-logfile - --workers 3 --bind unix:/home/myname/django_project/django_project.sock ......
6 月 8 日 18:18:04 ip-172-31-16-86.us-east-2.compute.internal systemd[1]: gunicorn.service 缺少 ExecStart= 和 ExecStop= 设置。 拒绝。
我确定文件中指定的绝对路径是正确的,但我得到了错误。
我该如何解决这个问题?
*注意:
Amazon Linux2 不包括www-data 组,所以我使用groupadd 命令创建。
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
目录结构
home
│
└─myname
│
├─django_project
│ ├─django_project
│ ├─manage.py
│ └─django_project.sock
│
└─venv
└─bin
└─gunicorn
操作系统 Amazon Linux2
独角兽 20.1.0
boto 2.49.0
Django 3.2.4
django-ses 2.0.0
【问题讨论】:
标签: django gunicorn amazon-linux-2