How do I deploy a django project that uses the 'django-hosts' python packages (for subdomain routing) to route subdomains?

How do I deploy a django project that uses the ‘django-hosts’ python packages (for subdomain routing) to route subdomains?

django-hosts python package is used for subdomain routing in django.
With this, I can route my app that is called ‘shop’ to ‘shop.localhost:8000’ instead of the usual ‘localhost:8000/shop’ (as configured in the urls.py file)

When configured probably, it works perfectly for the local server, but when pushed to a live production server, it does work, and I’ll begin to get errors like ‘ERR_SSL_PROTOCOL_ERROR’ even after configuring the DNS.

I’ve tried several cloud hosting services with more than one DNS but it still does work.

Is there any way out ??

If you’re using SSL, then you need to ensure that you’re using a certificate that either handles all the individual subdomains or uses a wildcard cert. (Using a cert for example.com does not work for www.example.com. You would need a cert for either www.example.com or *.example.com for it to work.)

Also, your web server (nginx, apache, etc) need to be configured to support the multiple hosts.