gpt4 book ai didi

gunicorn.service: Failed at step CHDIR spawning */env/bin/gunicorn: No such file or directory(Gunicorn.service:在步骤CHDIR派生失败*/env/bin/genicorn:没有这样的文件或目录)

转载 作者:bug小助手 更新时间:2023-10-25 10:40:56 27 4
gpt4 key购买 nike



gunicorn.service cannot open WorkingDirectory and the gunicorn executable. I think it's about permissions but I don't know how I can solve it.

Gunicorn.service无法打开WorkingDirectory和Gunicorn可执行文件。我认为这是关于权限的问题,但我不知道如何解决它。


sudo systemctl status gunicorn:

SUDO SYSTEM CTL STATE GONICORN:


Mar 15 12:12:42 ns1.localhost.com systemd[1]: Started gunicorn daemon.
Mar 15 12:12:42 ns1.localhost.com systemd[16439]: gunicorn.service: Changing to the requested working directory failed: No such file or directory
Mar 15 12:12:42 ns1.localhost.com systemd[16439]: gunicorn.service: Failed at step CHDIR spawning /home/radarkes-api/env/bin/gunicorn: No such file or directory
Mar 15 12:12:42 ns1.localhost.com systemd[1]: gunicorn.service: Main process exited, code=exited, status=200/CHDIR
Mar 15 12:12:42 ns1.localhost.com systemd[1]: gunicorn.service: Failed with result 'exit-code'.

/etc/systemd/system/gunicorn.service:

/etc/SYSTEM/SYSTEM/GURICORn.SERVICE:


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

[Service]
User=root
Group=www-data
WorkingDirectory=/home/radarkes-api/src
ExecStart=/home/radarkes-api/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/radarkes-api/src/core.sock core.wsgi:application

[Install]
WantedBy=multi-user.target

I can run /home/radarkes-api/env/bin/gunicorn manually, this is the output which means I can access the gunicorn executable:

我可以手动运行/home/radarkes-api/env/bin/genicorn,这是输出,这意味着我可以访问genicorn可执行文件:


usage: gunicorn [OPTIONS] [APP_MODULE]
gunicorn: error: No application module specified.

I tried:

我试过:



  • Adding "source /home/radarkes-api/env/bin/activate &&" at the start of ExecStart.

  • chmod -R 777 /home/radarkes-api


tree -d -L 2 /home/radarkes-api/:

树-d-L 2/主页/雷达克斯-api/:


radarkes-api/
├── env
│   ├── bin
│   └── lib
└── src
├── api
└── core

How can I solve this?

我怎么才能解决这个问题?


更多回答

Were you able to solve it? if yes please kindly notify. I am also facing the same problem currently.

你能解决这个问题吗?如果是,请告知。我现在也面临着同样的问题。

I solved it but I don't remember how, sorry.

我解决了,但我不记得是怎么解决的,对不起。

I was using an outdated digital ocean article dated from 2016. So i finally solved it by going through this updated article in which the gunicorn setting was simpler and more straightforward: digitalocean.com/community/tutorials/…

我使用的是2016年的一篇过时的数字海洋文章。所以我最终通过阅读这篇更新的文章解决了这个问题,在这篇文章中,黑角兽的设置更简单、更直接:DigitalOcean/Community/Tutorials/…

优秀答案推荐

ExecStart must be a sub-path of WorkingDirectory

ExecStart必须是WorkingDirectory子路径


in your example /etc/systemd/system/gunicorn.service will look like this:

在您的示例中,/etc/systemd/system/genicorn.service将如下所示:


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

[Service]
User=root
Group=www-data
WorkingDirectory=/home/radarkes-api/src
ExecStart=/home/radarkes-api/src/env/bin/gunicorn --access-logfile - --workers 3 --bind unix:/home/radarkes-api/src/core.sock core.wsgi:application

[Install]
WantedBy=multi-user.target

PS:

PS:



  1. In your case, it's preferable to create a new virtual env instead of moving your existing env folder inside of src one (to avoid paths issues),

  2. Make sure all your pip3 requirements are available in your requirements.txt file,

  3. Make sure your .gitignore includes the new virtual env folder


Then execute:

然后执行:


$ cd /home/radarkes-api/src
$ python3 -m venv MyEnvName
$ echo 'MyEnvName/' >> .gitignore
$ pip3 install -r requirements.txt

更多回答

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com