首页 > 解决方案 > 如何解决错误“可执行路径不是绝对的,忽略:”

问题描述

我目前正在Amazon Linux2使用DjangoNginxGunicorn和开发一个应用程序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

标签: djangogunicornamazon-linux-2

解决方案


希望其他人会有更好的答案或建议,但此讨论强调仔细检查 Gunicorn 可执行文件的路径是否存在或确保您的环境能够识别它。

这个讨论还进一步强调检查一切是否安装正确


推荐阅读