MCPcopy
hub / github.com/django/django / get_domain

Method get_domain

django/contrib/sitemaps/__init__.py:87–101  ·  view source on GitHub ↗
(self, site=None)

Source from the content-addressed store, hash-verified

85 return self.protocol or protocol or "https"
86
87 def get_domain(self, site=None):
88 # Determine domain
89 if site is None:
90 if django_apps.is_installed("django.contrib.sites"):
91 Site = django_apps.get_model("sites.Site")
92 try:
93 site = Site.objects.get_current()
94 except Site.DoesNotExist:
95 pass
96 if site is None:
97 raise ImproperlyConfigured(
98 "To use sitemaps, either enable the sites framework or pass "
99 "a Site/RequestSite object in your view."
100 )
101 return site.domain
102
103 def get_urls(self, page=1, site=None, protocol=None):
104 protocol = self.get_protocol(protocol)

Callers 2

get_urlsMethod · 0.95
runMethod · 0.80

Calls 4

is_installedMethod · 0.80
get_currentMethod · 0.80
get_modelMethod · 0.45

Tested by

no test coverage detected