Vaibhav Jain
Vaibhav Jain

Reputation: 5507

How to run different Django apps on different subdomain

Can it be possible to run Different Django apps on different Subdomains. For Example:

For api.mydomain.com all request will be handled by my API app. But all other requests will be handled by my core app. I just want my API app to handle request made on api.mydomain.com. And all other requests should simply be passed to www.mydomain.com.

Upvotes: 3

Views: 1451

Answers (2)

Vaibhav Jain
Vaibhav Jain

Reputation: 5507

I have used django-subdomains.

Subdomain helpers for the Django framework, including subdomain-based URL routing and reversing.

Found solution at http://django-subdomains.readthedocs.org/en/latest/index.html

Upvotes: 1

Cartucho
Cartucho

Reputation: 3329

Not exactly the answer to your question, but if you are looking for providing an API to your website, Django Rest Framework is recommended for doing it. With DRF you can can serve both regular webpages (TemplateHTMLRenderer) and API responses (JSONRenderer) in the same URI depending on the request.

If you really need to have your API in a different subdomain then the advice of het.oosten can work for you.

Hope it helps.

Upvotes: 0

Related Questions