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 "127.0.0.1" to ALLOWED_HOSTS in settings.py.

settings.py


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

#2


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

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


ALLOWED_HOSTS = ['*'] 

In Production

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


ALLOWED_HOSTS = ['domain_name.com'] 

Summary

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

English today is not an art to be mastered it's just a tool to use to get a result