Last modified: Jan 10, 2023 By Alexander Williams

How to Solve DisallowedHost at / Django

in this post, we'll learn how to solve DisallowedHost at / in Django.

In local host

If your app in the localhost, you need to add "localhost" or "" to ALLOWED_HOSTS in

ALLOWED_HOSTS = ['localhost'] #if you use localhost as url


ALLOWED_HOSTS = [''] #if you use as url

If you want to allow each host you need to add '*' to ALLOWED_HOSTS.


In Production

if your app in production, you need to add the domain name to ALLOWED_HOSTS



So, in this article, we've learned how to solve DisallowedHost at/in Django.

if your app in production, you should only set domain name in ALLOWED_HOSTS