2012-12-04 3 views
7

gungorn, nginx, supervisord를 사용하여 장고 프로젝트를 배포합니다. INSTALL_APPS에 추가 된 virtualenv에 gunicorn을 설치했습니다. 명령 ./manage.py run_gunicorn -b 127.0.0.1:8999 작품 : 나는 nginx를 다시 시작 그 후gunicorn : 오류 (해당 파일 없음) nginx + gunicorn + 관리자

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; 
    } 
} 

:

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을 편집했다.

supervisord.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) 

어떤 파일이 있습니까? 프로젝트를 어떻게 배포 할 수 있습니까?

답변

1

virtualenv를 사용하고 있으므로 supervisord.conf에서 virtualenv가 사용하는 PATH로 환경을 설정해야합니다.

이 시도 :

[program:gunicorn] 
command=/home/user/bin/manage run_gunicorn -w 4 -b 127.0.0.1:8999 -t 300 --max-requests=1000 
environment=PATH="/home/user/bin/" 
... 

/home/user/bin/ 가정되는 것은 당신의 VIRTUALENV의 경로입니다.

+0

마십시오. 그러나 그것은 작동하지 않았다. – Olga

+0

supervisord.conf를 편집하고 추가했습니다 :'command =/home/user/my_project/bin/gunicorn_django -w 4 -b 127.0.0.1:9999 -t 300 --max-requests = 1000 directory =/home/user/my_project/stratatech/stratatech/그 bin/supevisorctl이 모두 시작한 후에, gunicorn이 시작되었습니다. 하지만 내 사이트는 server_name (nginx.conf)의 주소를 열지 않습니다. 왜? – Olga

+0

nginx.conf에서 변경 수신 111111111 : 80; 듣기 : 80; 그런 다음 nginx를 다시 시작하십시오. – jordanvg

13

향후 검색자를 위해이 문제가 발생했으며 Gunicorn 이진 파일의 전체 경로를 제공해야한다는 것이 문제였습니다. 어떤 이유로 든 PATH = 환경 변수를 지정해도 감독자가 바이너리를 찾을 수 없습니다. 일단/full_path/gunicorn 그것은 일했다. (어쩌면 환경 변수를 사용하여 올바르게 수행 할 수있는 방법이 있습니다.)

+1

우리의 경우에는 configs를 업데이트 한 후'supervisorctl reread'를 놓쳤으므로'start' 명령은 제거 된 바이너리를 찾고있었습니다. – cmbuckley

1

동일한 문제가 있었는데 실제로 가상 환경에 gunicorn이 설치되어 있지 않습니다.

내가 그것을 시도

pip install gunicorn==<version_number> 
+0

'gunicorn'을 설치 한 다음 시도해 보는 것이 좋습니다. – CinCout

관련 문제