Erik Åsland
Erik Åsland

Reputation: 9802

DisallowedHost at / even though ALLOWED_HOSTS are correct

I am getting the following error when navigating to the url for my test site...

enter image description here

My settings.py file looks correct... enter image description here

Is there any other reason that anyone can think of why I might be getting this error? I have tried deleting all .pyc files and restarting nginx and tried multiple ALLOW_HOSTS settings.

I am using Amazon EC2 and Django 1.10.4

Upvotes: 1

Views: 2042

Answers (3)

I experienced this problem while using App Service.

First make sure you have defined ALLOWED_HOSTS correctly in your settings.py If you are using environment variables, make sure to set it by going to Settings, then Configuration, then click on New Application Settings; in the Name field, set the name of the environment variable and in the Value field, set the value.

If you've done this or you didn't use environment variables, go to Overview in the menu and either Stop and Start your app or restart your app.

Upvotes: 0

Thiago da Costa
Thiago da Costa

Reputation: 11

I came across this problem and I found a solution here by George:

"...I restarted the instance I was working on."

I am running an Ubuntu(20.04) EC2 instance on AWS.

Upvotes: 1

Daniel Butler
Daniel Butler

Reputation: 3756

Using digital ocean I was able to fix this issue by restarting uwsgi with the following in the terminal

systemctl restart uwsgi.service

Upvotes: 1

Related Questions