django - gunicorn:错误(无此类文件)nginx + gunicorn +主管

标签 django nginx gunicorn supervisord

我在有监督的ginicorn部署我的django项目。
我在virtualenv中安装了gunicorn,添加到INSTALL_APPS中。
命令./manage.py run_gunicorn -b 127.0.0.1:8999可以工作:

2012-12-04 12:27:33 [21917] [INFO] Starting gunicorn 0.16.1
2012-12-04 12:27:33 [21917] [INFO] Listening at: http://127.0.0.1:8999 (21917)
2012-12-04 12:27:33 [21917] [INFO] Using worker: sync
2012-12-04 12:27:33 [22208] [INFO] Booting worker with pid: 22208

对于nginx,我编辑了nginx.conf:
server {
    listen 111111111:80;
    server_name my_site.pro; 

    access_log /home/user/logs/nginx_access.log;
    error_log /home/user/logs/nginx-error.log;

    location /static/ {
        alias /home/user/my_project/static/;
    }
    location /media/ {
        alias /home/user/my_project/media/;
    }
    location / {
        proxy_pass http://127.0.0.1:8999;
        include /etc/nginx/proxy.conf;
    }
}

之后,我重新启动了nginx。

administratord.conf:
[unix_http_server]
file=/tmp/supervisor-my_project.sock  
chmod=0700                
chown=user:user

[supervisord]
logfile=/home/user/logs/supervisord.log
logfile_maxbytes=50MB        
logfile_backups=10           
loglevel=info                
pidfile=/tmp/supervisord-my_project.pid
nodaemon=false              
minfds=1024                  
minprocs=200 

[rpcinterface:supervisor]
supervisor.rpcinterface_factory = supervisor.rpcinterface:make_main_rpcinterface

[supervisorctl]
serverurl=unix:///tmp/supervisor-my_project.sock 

[program:gunicorn]
command=/home/user/bin/manage run_gunicorn -w 4 -b 127.0.0.1:8999 -t 300 --max-   requests=1000
startsecs=10
stopwaitsecs=60
redirect_stderr=true
stdout_logfile=/home/user/gunicorn.log

我跑了bin/supervisorctl start all。但是我得到了:
gunicorn: ERROR (no such file)

缺少什么文件?如何部署我的项目?

最佳答案

对于将来的搜索者,我遇到了这个问题,问题是我需要提供通往Gunicorn二进制文件的完整路径。无论出于何种原因,即使使用PATH =环境变量,指定的主管也无法找到二进制文件。一旦我/full_path/gunicorn它就起作用了。 (也许有一种方法可以使用环境变量正确地执行此操作)

关于django - gunicorn:错误(无此类文件)nginx + gunicorn +主管,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13711486/

相关文章:

python - 根目录下静态站点的 Nginx 配置,子目录下的 Flask 应用

django - 如何使用 Django 编写 Facebook 应用程序?

Python:如何从类所在的范围获取常量?

ruby-on-rails - nginx.conf - Passenger_env_var 未在 Rails 中加载

nginx - 为什么基本身份验证不能与简单的 nginx return 语句一起使用?

django - 获取 pkg_resources.DistributionNotFound : The 'supervisor==3.2.0' distribution was not found and is required by the application?

python - 使用 Django 的 CreateView 如何在保存前修改表单数据?

django - 如何在 django import-export 的导出上添加页眉/页脚?

django - 将应用程序级别的用户名/用户 ID 注入(inject) nginx/Apache 日志

python-3.x - 如何为通过 Gunicorn 运行的 Flask 应用程序获取 SSL?