我有这个 upstart 脚本,是我使用 https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-14-04 上的教程制作的.除了我不使用 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
使用 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
但是,当我从管理目录运行 exec gunicorn --workers 3 --bind unix:/home/userx/Documents/Test/Test.sock Test.wsgi:application
时。 py 就在里面,顺利启动。然后当我执行 ps ax | grep gunicorn
我看到 worker 出现了。
知道我在这里做错了什么吗?
最佳答案
好的,所以只需要将 .sock 文件放在/tmp 中就可以了。此外,如果其他人有提供静态文件的权限,403 错误,这只是授予 nginx 文件权限的问题。
关于linux - Gunicorn Upstart 脚本启动失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36378168/