django - 如何解决错误“可执行路径不是绝对的,忽略:”
问题描述
我目前正在Amazon Linux2
使用Django
、Nginx
、Gunicorn
和开发一个应用程序Postgresql
。
我已经创建并配置了一个系统文件,Gunicorn
以便在操作系统启动时工作,但启动后gunicorn
出现以下错误...
Jun 08 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 ......
Jun 08 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
操作系统亚马逊 Linux2
独角兽 20.1.0
博托 2.49.0
Django 3.2.4
django-ses 2.0.0
解决方案
推荐阅读
- mysql - laravel 错误 1071 密钥太长 php artisan 迁移
- spring - 如何将变量内插到“then”表达式中
- swiftui - Swift Health Kit 查询
- c - 为什么 int 在 printf 函数中会被格式化为 %#X?
- reactjs - 如何让 create-react-app 安装所有文件夹和文件?
- javascript - 如何自定义 react-draft-wysiwyg 的样式?
- javascript - 我想使用浏览器中的扩展从 Google Doc 中提取文本并保留语义换行符
- javascript - 调度操作后清除 Redux 状态
- javascript - 迭代对象内部的数组
- javascript - 如何使用 Plotly lib 聚合图形?