4

My application is going to be hosted in multiple domains, I need a domain name in django view function...How to achieve this? I am using django 1.3.3.

I want something like this

www.syz.com 127.0.0.1:8000

BenMorel
  • 34,448
  • 50
  • 182
  • 322
Vb407
  • 1,577
  • 2
  • 15
  • 27

1 Answers1

3

Have a look at request.get_host()

Doc: https://docs.djangoproject.com/en/dev/ref/request-response/#django.http.HttpRequest.get_host

Or in your template (if you use a requestContext) {{request.get_host}}

as @jayanth-koushik mentionned it, you can find more here: How can I get the domain name of my site within a Django template?

Community
  • 1
  • 1
abrunet
  • 1,122
  • 17
  • 31