简体   繁体   English

主管无法启动 Gunicorn:ENOENT

[英]Supervisor cannot start Gunicorn: ENOENT

I have deployed Django using gunicorn and nginx.我已经使用 gunicorn 和 nginx 部署了 Django。 The django project is located in a virtual environment. django 项目位于虚拟环境中。 Everything is working perfectly when I run -当我运行时,一切都运行良好 -

gunicorn mydjangoproject.wsgi -c gunicorn_config.py gunicorn mydjangoproject.wsgi -c gunicorn_config.py

I am running the above command inside my Django project folder containing manage.py with the virtual environment active.我在包含 manage.py 的 Django 项目文件夹中运行上述命令,虚拟环境处于活动状态。

However now i want to close the server terminal and want gunicorn to run automatically.但是现在我想关闭服务器终端并希望 gunicorn 自动运行。 For this I am using Supervisor.为此,我正在使用主管。 I have installed supervisor using apt-get and created a gunicorn.conf file in supervisor's conf.d.我已经使用 apt-get 安装了主管,并在主管的 conf.d 中创建了一个 gunicorn.conf 文件。

But when I run supervisorctl start gunicorn I am getting a fatal error-但是当我运行 supervisorctl start gunicorn 时,我收到了一个致命错误 -
gunicorn: ERROR (abnormal termination) gunicorn:错误(异常终止)

So checked the log file and it says-所以检查了日志文件,它说-

supervisor:couldn't exec root/ervirtualenvpy2/bin/gunicorn: ENOENT主管:无法执行 root/ervirtualenvpy2/bin/gunicorn:ENOENT
child process was not spawned未生成子进程

My configuration file for supervisor's gunicorn.conf looks like this-我的主管的 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

Going by what you said and your config everything seems right except that you have specified relative path rather than absolute path:按照你所说的和你的配置,一切似乎都是正确的,除了你指定了相对路径而不是绝对路径:

see gunicorn docs查看 gunicorn文档

Instead it should be:相反,它应该是:

[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

Also Check your gunicorn file path in env/bin/gunicorn file还要检查 env/bin/gunicorn 文件中的 gunicorn 文件路径

In my case, I changed my env directory to another place, so please be sure with that Wrong path: #!/home/ubuntu/nikhil_project/env/bin/python Correct path: #!/home/ubuntu/env/bin/python就我而言,我将env目录更改为另一个位置,因此请确保使用错误路径: #!/home/ubuntu/nikhil_project/env/bin/python正确路径: #!/home/ubuntu/env/bin/python

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM