502 Bad Gateway


I have just setup a droplet using the one-click install for django. I uploaded all my file and have been following a tutorial that multiple people have recommended to me. I got two errors, one I fixed which sent to another error that looked more-or-less like this:

RuntimeError: Model class django.contrib.sites.models.Site doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS

However, in trying to fix the problem I ran service gunicorn restart in my terminal hoping that the problem would be resolved. However, it did not work and not I am getting this:

502 Bad Gateway

nginx/1.10.3 (Ubuntu)

I am really annoyed because DO doesn’t seem to have a phone number so I have to wait around in an online forum to get help and I can’t seem to find anything online about this. I am beginner with all this stuff, so if you can help it would be greatly appreciated.


add your app name in installed app in then,

  1. modify first occurrence of ALLOWED_HOSTS = [‘*’] in your file
  2. modify at the bottom of your file ALLOWED_HOSTS += ip_addresses()
  3. then “systemctl restart gunicorn” as root
  4. then “systemctl restart nginx” as root

Submit an answer
You can type!ref in this text area to quickly search our full set of tutorials, documentation & marketplace offerings and insert the link!

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 got the same error but i am trying to upload a django project that is already created, I change the file and also the urls but still I am getting the same problem, what can I do this is annoying?