Gunicorn:在执行步骤生成时失败没有这样的文件或目录

Abh*_*lik 5 python flask gunicorn

我正在尝试设置我的gunicorn。以下是我的 systemmd 配置文件的配置文件:

# Unit section is used to specify metadata and dependencies
[Unit]
Description=DEMO

# only start once the network target has been reached
After=network.target



# Service section specify the user and group that we want the process to run under
[Service]
# www-data group assigned to facilitate easy communication with nginx
Group=www-data

# path to working directory
WorkingDirectory=/srv/demo/git

# path to virtual environment
Environment="PATH=/srv/demo/git/venv/bin"

ExecStart=/srv/demo/git/venv/bin/gunicorn --workers=5 --bind unix:git.sock --log-level=debug wsgi:app --timeout 3600
#--workers=5 --threads=2 --worker-class=gthread 



[Install]
WantedBy=multi-user.target
~                                                                                                       
~                                                                                                       
~    

                                                                                               
Run Code Online (Sandbox Code Playgroud)

我的虚拟环境文件夹确实包含gunicorn:

在此输入图像描述

但我仍然无法运行这个,systemmd 文件说它无法找到gunicorn。没有这样的文件或目录:

在此输入图像描述

我已经从虚拟环境外部卸载了gunicorn。但是当我执行 which Gunicorn 时,它显示了 /usr/bin/gunicorn 的路径。当我放置此路径时,它不会抛出相同的错误,而只是说找不到 apt_pkg 和 Gunicorn 模块,但不是目录错误。这是路径问题吗?如果是这样我该如何修复它?

Jah*_*lam 9

我希望以下步骤将有助于解决这个问题......

\n
\n

步骤1:cd ~/myprojectdir

\n
\n
\n

步骤 2:源 myprojectenv/bin/activate

\n
\n
\n

第三步:哪个gunicorn

\n
\n
\n

步骤 4:将其粘贴到 guicorn 的 \xe2\x80\x98ExecStart\xe2\x80\x99 值交换 \xe2\x80\x98/etc/systemd/system/gunicorn.service\xe2\x80\x99 的路径部分'..../小路”

\n
\n
\n

步骤 5:sudo systemctl daemon-reload

\n
\n
\n

第6步:sudo systemctl重新启动gunicorn

\n
\n
\n

第7步:sudo systemctl status Gunicorn

\n
\n