【问题标题】:serve multiple gunicorn django instances under nginx ubuntu在 nginx ubuntu 下服务多个 gunicorn django 实例
【发布时间】:2017-03-12 22:59:16
【问题描述】:

我需要在 ubuntu 上使用 nginx 在 gunicorn 上以不同的域名提供两个网络应用程序 (Django)。我开始使用本教程: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

对于使用它的人来说效果很好。然后我尝试为第二个域做同样的事情,但它为我提供了第二个域的 502 网关。所以我尝试按照本教程进行操作: http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/

我正在运行 gunicorn 启动脚本的部分:

sudo bin/gunicorn_start

我收到回复:

Starting webuildblack as root
    Traceback (most recent call last):
        File "/home/devin/webuildblack/bin/gunicorn", line 7, in <module>
            from gunicorn.app.wsgiapp import run
                ImportError: No module named 'gunicorn.app'; 'gunicorn' is not a package

【问题讨论】:

  • 你应该先检查502 gateway问题。您可以检查 nginx 日志并在调试模式下运行 django 以查看有关问题的更多信息。有时它可能是简单的问题,例如数据库问题。

标签: python django ubuntu nginx


【解决方案1】:

您已将程序命名为 gunicorn.py,例如 gunicorn-package。重命名此文件并删除所有 gunicorn.pyc 文件。

【讨论】:

  • 从头开始说你是对的。我又试了一次,在我删除 pyc 文件后它起作用了。谢谢!
猜你喜欢
  • 1970-01-01
  • 2018-01-17
  • 1970-01-01
  • 2017-08-07
  • 2017-12-31
  • 2017-07-17
  • 1970-01-01
  • 2023-04-09
  • 2018-01-01
相关资源
最近更新 更多