subdomains.middleware¶
-
class
subdomains.middleware.
SubdomainMiddleware
¶ A middleware class that adds a
subdomain
attribute to the current request.-
get_domain_for_request
(request)¶ Returns the domain that will be used to identify the subdomain part for this request.
-
process_request
(request)¶ Adds a
subdomain
attribute to therequest
parameter.
-
-
class
subdomains.middleware.
SubdomainURLRoutingMiddleware
¶ A middleware class that allows for subdomain-based URL routing.
-
process_request
(request)¶ Sets the current request’s
urlconf
attribute to the urlconf associated with the subdomain, if it is listed insettings.SUBDOMAIN_URLCONFS
.
-
process_response
(request, response)¶ Forces the HTTP
Vary
header onto requests to avoid having responses cached across subdomains.
-