Django One Click Install not using project folder?

August 8, 2014 1.8k views

I get a 502 Gateway error on the webpage.

So I checked the Gunicorn log file at /var/log/upstart/gunicorn.log and I got an import error.

ImportError: No module named django_project.wsgi

Which is odd that it is using the django_project folder as I have configured everything to a folder named ProjectStar in the /home/django folder.


upstream app_server {
    server fail_timeout=0;

server {
    listen 80 default_server;
    listen [::]:80 default_server ipv6only=on;

    root /usr/share/nginx/html;
    index index.html index.htm;

    client_max_body_size 4G;
    server_name _;

    keepalive_timeout 5;

    # Your Django project's media files - amend as required
    location /media  {
        alias /home/django/ProjectStar/media;

    # your Django project's static files - amend as required
    location /static {
        alias /home/django/ProjectStar/static;

And the /etc/init/gunicorn.conf file

description "Gunicorn daemon for Django project"

start on (local-filesystems and net-device-up IFACE=eth0)
stop on runlevel [!12345]

setuid django
setgid django
chdir /home/django

exec gunicorn \
    --name=ProjectStar \
    --pythonpath=ProjectStar \
    --bind= \
    --config /etc/gunicorn.d/ \

I have tried restarting and stopping nginx and gunicorn but the error in the log does not change. Please help.

1 comment
  • I'm having exactly the same issue. Did you get the resolved? I'm dumping my django project into /home/django/django_project/ so I don't have to modify gunicorn/nginx config files. Does that mean WSGI_APPLICATION in /home/django/django_project/my_app/ needs to change?

3 Answers

I found the solution to my problem: edit /etc/init/gunicorn.conf and change django_project.wsgi:application to my_app.wsgi:application (to match what's in

Maybe this is what was wrong with your setup as well.

Check the file for the project. Did you start by copying the one from the default project? It likely still contains the line:

WSGI_APPLICATION = 'django_project.wsgi.application'
  • Nope, just checked. The file is not a copy. The project runs locally.

    On another instance I was about to get the project working if I renamed it to django_project, but that isn't really an ideal workflow.

    Any other ideas?

yes u need to do changes in as well as

Have another answer? Share your knowledge.