2016-09-26 67 views
1

**检查过了堆栈溢出**Gunicorn + Django的+主管 - 主管无法启动Gunicorn:ENOENT

我一直在使用gunicorn和nginx的部署Django的。 django项目位于虚拟环境中。一切都可以正常使用,当我运行 -

gunicorn mydjangoproject.wsgi -c gunicorn_config.py

我运行包含manage.py与虚拟环境中进行活动我的Django项目文件夹内的上述命令。

但是现在我想关闭服务器终端并希望gunicorn自动运行。为此我正在使用主管。我已经使用apt-get安装了主管,并在主管的conf.d中创建了gunicorn.conf文件。

但是当我运行supervisorctl开始gunicorn我得到一个致命的错误 -
gunicorn:ERROR(异常终止)

所以检查日志文件,并将其says-

主管:能不能Exec根/ ervirtualenvpy2 /斌/ gunicorn:ENOENT
子进程并没有催生

对上司的gunicorn.conf我的配置文件看起来像这个 -

[program:gunicorn] 
command = root/ervirtualenvpy2/bin/gunicorn myproject.wsgi -c  root/path/to/the/gunicorn_conf.py/file 
directory = root/ervirtualenvpy2/path/to/myproject/ 
user=root 
autorestart=true 
+0

ENOENT表示文件未找到。检查你的文件路径和supervisord访问权限。 –

+0

为什么你如此热衷于使用管理员而不是已经包含在系统中的新贵或systemd? –

+0

嗯,我正在使用管理员,因为将来我想将芹菜,rabbitmq和memcached添加到我的项目中,并且我对所有此服务器设置和部署都很陌生,所以我对新贵和systemd不太了解。我依靠的是我在开始研究这个设置时发现的信息,并且我第一次遇到了主管。 –

回答

1

由你说什么,你的配置一切似乎是正确的,除了您指定相对路径,而不是绝对路径展望:

看到gunicorn docs

相反,它应该是:

[program:gunicorn] 
command = /root/ervirtualenvpy2/bin/gunicorn myproject.wsgi -c /root/path/to/the/gunicorn_conf.py/file 
directory = /root/ervirtualenvpy2/path/to/myproject 
user=root 
autorestart=true