Django 如何修复gunicorn.service:加载环境失败

Django 如何修复gunicorn.service:加载环境失败,django,ubuntu,nginx,gunicorn,systemd,Django,Ubuntu,Nginx,Gunicorn,Systemd,当我跑的时候 sudo journalctl -u gunicorn 我得到: Oct 14 12:49:22 django-ubuntu-helpme systemd[1]: gunicorn.service: Failed to load environment > Oct 14 12:49:22 django-ubuntu-helpme systemd[1]: gunicorn.service: Failed to run 'start' task:> Oct 14 12:

当我跑的时候

sudo journalctl -u gunicorn
我得到:

Oct 14 12:49:22 django-ubuntu-helpme systemd[1]: gunicorn.service: Failed to load environment >
Oct 14 12:49:22 django-ubuntu-helpme  systemd[1]: gunicorn.service: Failed to run 'start' task:>
Oct 14 12:49:22 django-ubuntu-helpme  systemd[1]: gunicorn.service: Failed with result 'resourc>
Oct 14 12:49:22 django-ubuntu-helpme  systemd[1]: Failed to start gunicorn daemon.
我想有些东西和我的目录不符。我有

/etc/systemd/system/gunicorn.service
,即:

[Unit]
Description=gunicorn daemon
Requires=gunicorn.socket
After=network.target

[Service]
User=myname
Group=myname
EnvironmentFile=/home/myname/myapp/env
WorkingDirectory=/home/myname/myapp
ExecStart=/home/myname/myapp/env/bin/gunicorn \
          --access-logfile - \
          --workers 3 \
          --bind unix:/run/gunicorn.sock \
          myapp.wsgi:application

[Install]
WantedBy=multi-user.target
我工作的目录如下

myapp/
有我的
requirements.txt文件、
env/
和另一个
app/
目录。在
myapp/app
中,我有
manage.py
、一个包含我导出的密钥的env文件和另一个
app/
目录。在
myapp/app/app中,
我有
settings.py
wsgi.py


我做错了什么?

环境文件应该是文本文件而不是目录。请通过:@VidyaSagar发现得很好,谢谢!!EnvironmentFile应该是文本文件而不是目录。请通过:@VidyaSagar发现得很好,谢谢!!