0

How can we add 'blog.site_name.com' or such types of url in Django instead of 'site_name.com/blog/' to urls.py in Django? I want to make URLs like 'mail.google.com', 'drive.google.com'. How can we make such urls in Django? Is there any easy way to do this?

Anish Shah
  • 7,669
  • 8
  • 29
  • 40
  • Take a look at [django-subdomains](https://github.com/tkaemming/django-subdomains) or [django-hosts](https://github.com/jezdez/django-hosts) package. – alecxe Jan 10 '14 at 17:20

1 Answers1

0

You can create two urlconf files, one for site_name.com, another for blog.site_name.com. Then you make a custom middleware that will switch the urlconf based on domain name. See Django docs for details.

Andrey Fedoseev
  • 5,222
  • 1
  • 24
  • 19