get the current site object in a django view Mar
22
1
0

You can use the default Sites framework to get the current site in a django view.

from django.contrib.sites.models import Site

site = Site.objects.get_current()
domain = Site.objects.get_current().domain

or

from django.contrib.sites.models import Site
from django.conf import settings

site = Site.objects.get(id=settings.SITE_ID)
Bookmark and Share
blog comments powered by Disqus