502 Bad Gateway

September 25, 2017 1.2k views
Django Ubuntu 16.04

Hi,

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.

1 comment
  • add your app name in installed app in settings.py
    then,

    1. modify first occurrence of ALLOWED_HOSTS = ['*'] in your settings.py file
    2. modify at the bottom of your settings.py file ALLOWEDHOSTS += ipaddresses()
    3. then "systemctl restart gunicorn" as root
    4. then "systemctl restart nginx" as root
1 Answer

I got the same error but i am trying to upload a django project that is already created, I change the sattings.py file and also the urls but still I am getting the same problem, what can I do this is annoying?

Have another answer? Share your knowledge.