Devin Jackson Devin Jackson - 1 month ago 14
Python Question

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. 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

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. So I tried following this tutorial:
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:

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

Answer

You have named your program gunicorn.py like the gunicorn-package. Rename your this file and remove any gunicorn.pyc file.