【问题标题】:Supervisor not reloading Gunicorn properly with Django project主管没有使用 Django 项目正确重新加载 Gunicorn
【发布时间】:2021-12-28 09:19:26
【问题描述】:

在将 Django 项目推送到生产环境时,我正在使用 Supervisor 重新加载 Gunicorn

工作流程

          " && python manage.py migrate"\
          " && python manage.py collectstatic --noinput"\
          " && supervisorctl restart frontdesk-gunicorn"\
          " && exit"

主管配置

   [program:project-gunicorn]
    command=/home/gaetangr/project/myprojectenv/bin/gunicorn config.wsgi:application
    user = gaetangr
    directory = /home/gaetangr/project
    autostart = true
    autorestart = true

但大多数时候,为了传播所有更改,我必须执行 sudo :

systemctl restart gunicorn

据我了解,主管的命令应该完全相同。

有什么想法吗?

【问题讨论】:

  • 兄弟将服务器相关问题发到serverfault.com,他们会更好地回答问题

标签: django gunicorn supervisord


【解决方案1】:

一段时间后我想通了,所以你去吧。

我最初使用服务来运行Gunicorn,有一段时间是这样安静的,但后来我发现了这个:

supervisord 通过创建子流程来管理流程。如果您使用 systemctl 启动 gunicorn,那么 supervisord 将不会知道有关此 gunicorn 的任何信息,也无法重新启动它。仅使用一个进程管理系统 - supervisordsystemd

在我的情况下,我必须删除运行 Gunicorn 的服务以及套接字,并更新我的 Nginx 配置以删除到 Gunicorn 的代理服务链接。

【讨论】:

    猜你喜欢
    • 2011-08-10
    • 1970-01-01
    • 2015-08-01
    • 2023-03-21
    • 2014-02-02
    • 1970-01-01
    • 2017-08-18
    • 2013-12-12
    • 2013-02-11
    相关资源
    最近更新 更多