Skip to content Skip to sidebar Skip to footer

Django: 400 Error With Debug=false And Allowed_hosts=["*"]

I'm trying to run a relatively simple Django server on Python 3.5.3 on an Ubuntu DigitalOcean droplet. I'm using a Gunicorn server with nginx. The server runs fine when DEBUG=True

Solution 1:

Make sure that the config in nginx has the proper alias using absolute paths (ie: /etc/nginx/sites-enabled) It doesn't work if the alias was done with a relative path for whatever reason.

This are the appropriate settings for nginx at the location / {} section:

proxy_set_header X-Forwarded-For$proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-Proto $scheme;
proxy_redirect off;
include uwsgi_params;
proxy_pass http://unix:/home/thomas/KivaWebsite/KivaWebsite.sock;

Post a Comment for "Django: 400 Error With Debug=false And Allowed_hosts=["*"]"