Deployment Error: Disallowed Host at-

I am trying to host a django website on digital ocean through nginx. I have also mentioned domain in but getting error as below:

DisallowedHost at /
Invalid HTTP_HOST header: ''. You may need to add '' to ALLOWED_HOSTS.
Request Method:	GET
Request URL:
Django Version:	3.0.7
Exception Type:	DisallowedHost
Exception Value:	
Invalid HTTP_HOST header: ''. You may need to add '' to ALLOWED_HOSTS.
Exception Location:	/home/pranav/proutm/proutenv/lib/python3.6/site-packages/django/http/ in get_host, line 122
Python Executable:	/home/pranav/proutm/proutenv/bin/python
Python Version:	3.6.9
Python Path:	
Server time:	Wed, 8 Jul 2020 03:48:34 +0000
Traceback Switch to copy-and-paste view
/home/pranav/proutm/proutenv/lib/python3.6/site-packages/django/core/handlers/ in inner
            response = get_response(request) …
▶ Local vars
/home/pranav/proutm/proutenv/lib/python3.6/site-packages/django/utils/ in __call__
            response = self.process_request(request) …
▶ Local vars
/home/pranav/proutm/proutenv/lib/python3.6/site-packages/django/middleware/ in process_request
        host = request.get_host() …
▶ Local vars
/home/pranav/proutm/proutenv/lib/python3.6/site-packages/django/http/ in get_host
            raise DisallowedHost(msg) …
▶ Local vars 

Submit an answer

This textbox defaults to using Markdown to format your answer.

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

Sign In or Sign Up to Answer

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.

Want to learn more? Join the DigitalOcean Community!

Join our DigitalOcean community of over a million developers for free! Get help and share knowledge in Q&A, subscribe to topics of interest, and get courses and tools that will help you grow as a developer and scale your project or business.

Hi there @pramod0021a,

I think that in your, you might have to specify both of your www and the non-www versions fo your domain name under the ALLOWED_HOSTS:

ALLOWED_HOSTS = ['your_server_domain_or_IP', '', '' . . .]

Let me know if this works! Regards, Bobby