gpt4 book ai didi

django - Supervisorctl总是报错: ERROR (no such file)

转载 作者:行者123 更新时间:2023-12-02 06:47:36 27 4
gpt4 key购买 nike

我用uwsgi、supervisor和nginx部署了我的django项目。但我已经在/etc/supervisord.conf 中添加了上面的程序。

[program:JZAssist]
command=-E uwsgi --ini /home/work/xxxx/uwsgi.ini
directory=/home/work/xxxx
startsecs=0
stopwaitsecs=0
autostart=true
autorestart=true

我的 uwsgi.ini 内容是:

[uwsgi] 
socket = :8000
chdir = /home/work/xxxx
module = xxxx.wsgi
master = true
processes = 4
vacuum = true

xxxx 是我的项目名称。

我在cmd中运行supervisorctl -c/etc/supervisord.conf restart all。它显示

xxxx: ERROR (no such file)

/tmp/supervisord.log部分内容:

2017-02-24 23:31:41,433 INFO gave up: JZAssist entered FATAL state,         too many start retries too quickly
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:29,940 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-24 23:52:57,535 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'
2017-02-24 23:52:57,541 INFO RPC interface 'supervisor' initialized
2017-02-24 23:52:57,541 CRIT Server 'unix_http_server' running without any HTTP authentication checking
2017-02-24 23:52:57,542 INFO daemonizing the supervisord process
2017-02-24 23:52:57,543 CRIT could not write pidfile /tmp/supervisord.pid
2017-02-24 23:52:58,544 INFO spawnerr: can't find command '-E'
2017-02-24 23:52:59,546 INFO spawnerr: can't find command '-E'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stderr---supervisor-goPZyS.log'
2017-02-25 00:46:59,234 WARN Failed to clean up '/tmp/JZAssist-stdout---supervisor-WtfJcp.log'

我不知道为什么会报这样的错误。我可以用runserver运行我的django项目。那么缺少什么文件?

最佳答案

在您的 command= 行中,您已指定要运行的程序为 -E,但主管无法找到要执行的程序。

为作业创建文件时,命令行应可作为 shell 命令执行,并且不应依赖于给定 shell 的内部命令。例如,我遇到了以下开头的问题:

源/path/to/python/virtual/environment/bin/activate && ...

但是 source 是 bash 内置函数。我需要将其更改为:

bash -c '源/path/to/python/virtual/environment/bin/activate && ...

这样,supervisor可以找到并运行的可执行文件就是bash

就您而言,uwsgi 似乎应该是 command= 之后的第一件事。

您提到您在运行 sudo 时使用 -E 标志来保留环境变量,但主管不需要 sudo >

关于django - Supervisorctl总是报错: ERROR (no such file),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42443259/

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