Created
March 22, 2011 18:34
-
-
Save develmaycare/881765 to your computer and use it in GitHub Desktop.
A simple recipe for getting the virtual host name from within a Django view using RequestSite.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from django.contrib.sites.models import RequestSite | |
from django.shortcuts import render_to_response | |
def my_view(request): | |
domain = RequestSite(request).domain | |
# ... do some domain specific things here ... | |
return render_to_response("my_view.html") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment