linux - Gunicorn Upstart 脚本启动失败

标签 linux django nginx gunicorn upstart

我有这个 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/

相关文章:

docker - 通过 nginx websocket 代理连接时 WebApp 崩溃

nginx - 我可以将 Nginx 作为代理放在其他代理池之前吗?

linux - RRDtool 在时间戳更新和修改 rrd 数据源

linux - 基本Unix复习查询: ls -ld

python - 如何从 csv 文件创建模型实例

django - 我应该为我的电子商务网站使用 JWT 还是 session ?

ruby-on-rails - 让一名工作人员在 Unicorn Nginx Rails 中持续运行

linux - 如何从字符串列表中提取结构?

python - Python 中的 bash 变量

django - 路由器和 View 集如何配置它们的 url?