Report this

What is the reason for this report?

After adding my domain to ALLOWED_HOSTS in django settings I am still getting a 502 error. Not sure why my settings are not recognized.

Posted on October 12, 2017

So, I created an Ubuntu droplet with nginx, gunicorn and django. I added my domain and when trying to access my django site I got a 502 error. I read in several places that adding my domain to ALLOWED_HOSTS should remedy the problem so I did that and still got the error. To make a long story that should have been shorter shorter I finally started gunicorn in the console and the stacktrace I am getting indicates that my domain probably needs to be added to ALLOWED_HOSTS but I already added it. After digging a little further I notice that there are three files that contain an ALLOWED_HOSTS variable. There is ./var/lib/digitalocean/settings.py, ./var/lib/digitalocean/allow_hosts.py and /home/django/django_project/django_project/settings.py. So far I have attempted adding my domain into each of thes files and still recieve the same error. This is a stupid, really really frustrating error. Anyone have any suggestions or have the same issue?

The developer cloud

Scale up as you grow — whether you're running one virtual machine or ten thousand.

Start building today

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.