【问题标题】:django nginx gunicorn,, start: Job failed to startdjango nginx gunicorn,, start: 作业启动失败
【发布时间】:2016-08-11 13:22:30
【问题描述】:

我正在尝试使用 nginx gunicorn 部署 django 项目的每个人,但是当我运行时

sudo 服务 gunicorn 启动, 它说, start: 作业启动失败,

这里是工作路径,,

gunicorn.conf 文件

/etc/init/gunicorn.conf

description "Gunicorn application server handling myproject"

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

respawn
setuid user
setgid www-data
chdir /home/parallels/books/mysite


exec myprojectenv/bin/gunicorn --workers 3 --bind unix:/home/parallels/books/mysite/mysite.sock mysite.wsgi:application

当我跑步时

gunicorn --bind 0.0.0.0:8000 mysite.wsgi:application

我可以看到我的网站正在运行

但是当我尝试时

sudo service gunicorn start

失败,,, 我只是following the instruction here

哪位能回复一下,非常感谢

【问题讨论】:

    标签: django nginx gunicorn


    【解决方案1】:

    我知道这为时已晚,但无论如何:

    1. 在您的 gunicorn.conf 中,我看到 setuid user,但您的提示中有用户 parallels(这取决于您的 bash 设置,但可能是当前用户的名称)。
    2. chdir /home/parallels/books/mysite,然后是exec myprojectenv/bin/gunicorn,我猜你的gunicorn位置是不是 /home/parallels/books/mysite/myprojectenv/bin/gunicorn。所以你需要使用合适的路径来运行 gunicorn。

    检查 gunicorn 日志文件以找出问题。应该在这里/var/log/upstart/gunicorn.log

    【讨论】:

      【解决方案2】:

      检查 exec 命令及其参数。如果您有任何问题,它将失败

      在我的情况下,我在 venv(虚拟 env)路径之后错过了 bin。 即 exec myprojectenv/bin/gunicorn --workers 3 --bind ...

      【讨论】:

        【解决方案3】:

        您需要将setuid user 更新为您的用户名和路径。

        【讨论】:

        • @JoeLin 您能否帮助我们了解所有适合您的答案?你提到感谢每一个答案:)
        猜你喜欢
        • 1970-01-01
        • 2021-08-26
        • 2016-11-18
        • 2019-04-20
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2012-05-27
        • 1970-01-01
        相关资源
        最近更新 更多