Fix Python – Invalid http_host header


Asked By – Kathiravan Natarajan

I am trying to develop a website using Django framework and launched using and deployed the necessary files into django-project.

I had to include static files into Django-project and After collecting static files, I tried to refresh my ip

I am including the tutorials which I have used to create the website.

I am getting the following error :

DisallowedHost at / Invalid HTTP_HOST header: ‘’. You may
need to add u’′ to ALLOWED_HOSTS.

Can somebody help me to fix this ? This is my first website using Django framework.

Now we will see solution for issue: Invalid http_host header


The error log is straightforward. As it suggested,You need to add to your ALLOWED_HOSTS setting.

In your project file,set ALLOWED_HOSTS like this :

ALLOWED_HOSTS = ['', 'localhost', '']

For further reading
read from here.

This question is answered By – Prakhar Trivedi

This answer is collected from stackoverflow and reviewed by FixPython community admins, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0