简体   繁体   English

在nginx ubuntu下服务多个gunicorn django实例

[英]serve multiple gunicorn django instances under nginx ubuntu

I need to serve up two webs apps (Django) on gunicorn under different domain names using nginx on ubuntu. 我需要在ubuntu上使用nginx以不同的域名在gunicorn上提供两个web应用程序(Django)。 I started using this tutorial: https://www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04 我开始使用本教程: https : //www.digitalocean.com/community/tutorials/how-to-set-up-django-with-postgres-nginx-and-gunicorn-on-ubuntu-16-04

It worked just fine for one using that. 使用它的人工作得很好。 Then I tried to do the same thing for the second but it gives me a 502 gateway for the second domain. 然后,我尝试对第二个域执行相同的操作,但它为第二个域提供了502网关。 So I tried following this tutorial: http://michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/ 因此,我尝试按照以下教程进行操作: http : //michal.karzynski.pl/blog/2013/10/29/serving-multiple-django-applications-with-nginx-gunicorn-supervisor/

I'm at the part where you run the gunicorn start script: 我是您运行gunicorn启动脚本的部分:

sudo bin/gunicorn_start

I get back the response: 我得到答复:

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

You have named your program gunicorn.py like the gunicorn -package. 您已将程序gunicorn.py命名为gunicorn.py gunicorn Rename your this file and remove any gunicorn.pyc file. 重命名此文件,然后删除所有gunicorn.pyc文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM