Question
Django One Click Install not using project folder?
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.
/etc/nginx/sites-enabled/django
upstream app_server {
server 127.0.0.1:9000 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=0.0.0.0:9000 \
--config /etc/gunicorn.d/gunicorn.py \
django_project.wsgi:application
I have tried restarting and stopping nginx and gunicorn but the error in the log does not change. Please help.
These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.
×
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 meanWSGI_APPLICATION
in/home/django/django_project/my_app/settings.py
needs to change?