class subdomains.middleware.SubdomainMiddleware

A middleware class that adds a subdomain attribute to the current request.


Returns the domain that will be used to identify the subdomain part for this request.


Adds a subdomain attribute to the request parameter.

class subdomains.middleware.SubdomainURLRoutingMiddleware

A middleware class that allows for subdomain-based URL routing.


Sets the current request’s urlconf attribute to the urlconf associated with the subdomain, if it is listed in settings.SUBDOMAIN_URLCONFS.

process_response(request, response)

Forces the HTTP Vary header onto requests to avoid having responses cached across subdomains.