django nginx gunicorn,,开始:作业无法启动

django nginx gunicorn,,开始:作业无法启动,django,nginx,gunicorn,Django,Nginx,Gunicorn,我正在尝试使用nginx gunicorn部署django项目,但当我运行 sudo服务gunicorn启动, 上面说,, 启动:作业无法启动 这里是工作路径,, gunicorn.conf文件 /etc/init/gunicorn.conf 当我跑的时候 gunicorn—绑定0.0.0.0:8000 mysite.wsgi:application 我可以看到我的网站在运行 但是当我尝试的时候 sudo服务gunicorn启动 失败,,, 我只是 任何能回复的人都非常感谢您您需要将setu

我正在尝试使用nginx gunicorn部署django项目,但当我运行

sudo服务gunicorn启动, 上面说,, 启动:作业无法启动

这里是工作路径,,

gunicorn.conf文件

/etc/init/gunicorn.conf

当我跑的时候

gunicorn—绑定0.0.0.0:8000 mysite.wsgi:application

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

但是当我尝试的时候

sudo服务gunicorn启动

失败,,, 我只是


任何能回复的人都非常感谢您

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

检查exec命令及其参数。如果你在这方面有任何问题,它就会失败

在我的例子中,我错过了一个接一个的bin(虚拟环境)路径。
ie exec myprojectenv/bin/gunicorn--workers 3--bind…

我知道这太晚了,但无论如何:

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

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

    @JoeLin你能帮我们从所有对你有用的答案中找到什么吗?您提到了感谢您的每一个回答:)
    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