djangodnslocalhostappdomain

Connect local domain to Django


I have several applications that I'm running on Docker. Each one of them has own domain, however when I start containers I can access them only on 127.0.0.1:8000 or 127.0.0.1:8001. But I need to reach them on domain like test1.mydomain.local and test2.mydomain.local.

I tried to change my host file like this:

127.0.0.1 *.mydomain.local

127.0.0.1 localhost

However when I start docker again - it doesn't work. I have .env file where all domains are written down but I don't get how to get this worked.

Please help me to figure it out.


Solution

  • It's not possible to specify wildcards in the host file. Set them explicitly or use a local DNS.