简体   繁体   English

Gunicorn upstart脚本无法启动

[英]Gunicorn upstart script fails to start

I have this upstart script I made using the tutorial at https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04 . 我有使用https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14上的教程制作的新贵脚本-04 Except I don't use virtualenv so I just have 'exec gunicorn' 除了我不使用virtualenv,所以我只有'exec gunicorn'

description "Test Django project"

start on runlevel [2345]
stop on runlevel [!2345]

respawn
setuid userx
setgid www-data
chdir /home/mahsan/Documents/Test

exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application

Using grep :init /var/log/syslog I find this: 使用grep :init /var/log/syslog我发现了这一点:

Apr 2 15:31:24 backbox kernel: [ 5296.877715] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5296.991094] init: gunicorn main process (4247) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5296.991133] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5297.102330] init: gunicorn main process (4249) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5297.102359] init: gunicorn main process ended, respawning Apr 2 15:31:24 backbox kernel: [ 5297.217514] init: gunicorn main process (4251) terminated with status 1 Apr 2 15:31:24 backbox kernel: [ 5297.217528] init: gunicorn respawning too fast, stopped Apr 2 15:40:04 backbox kernel: [ 5817.334970] init: gunicorn main process (4533) terminated with status 1 Apr 2 15:31:24 backbox内核:[5296.877715] init:gunicorn主进程结束,重新生成Apr 2 15:31:24 backbox内核:[5296.991094] init:gunicorn主进程(4247)终止,状态为1 Apr 2 15: 31:24 backbox内核:[5296.991133] init:gunicorn主进程结束,重新生成4月2日15:31:24 backbox内核:[5297.102330] init:gunicorn主进程(4249)终止,状态为1 Apr 2 15:31:24 backbox内核:[5297.102359]初始化:gunicorn主进程结束,重新生成4月2日15:31:24 backbox内核:[5297.217514]初始化:gunicorn主进程(4251)终止,状态为1 Apr 2 15:31:24 backbox内核:[5297.217528 ] init:gunicorn重新生成的速度太快,已停止Apr 2 15:40:04 backbox内核:[5817.334970] init:gunicorn主进程(4533)终止,状态为1

However, when I do run exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application from the directory that manage.py is in it starts without incident. 但是,当我运行exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application从manage.py所在的目录启动时,不会发生任何情况。 Then when I do ps ax | grep gunicorn 然后当我做ps ax | grep gunicorn ps ax | grep gunicorn I see the workers show up. ps ax | grep gunicorn我看到工露面。

Any idea what I am doing wrong here? 知道我在这里做错了吗?

Okay, so just had to have the .sock file in /tmp and it works. 好的,只需要在/ tmp中保存.sock文件即可。 Also, if anyone else had a permission with serving static files, 403 error, its just a matter of granting nginx permissions the files. 另外,如果其他任何人都有权提供静态文件,则将显示403错误,这只是向nginx授予文件权限。

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

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