Skip to main content

CurrentSiteMiddleware

Middleware that sets site attribute to request object.

Attributes

AttributeTypeDescription
sitedjango.contrib.sites.models.SiteThe current site instance associated with the request, determined by the get_current_site function.

Constructor

Signature

def CurrentSiteMiddleware(
get_response: callable
) - > null

Parameters

NameTypeDescription
get_responsecallableThe next middleware or view in the request/response chain.

Methods


process_request()

@classmethod
def process_request(
request: [HttpRequest](../../../http/request/httprequest.md?sid=django_http_request_httprequest)
) - > null

Middleware that sets site attribute to request object.

Parameters

NameTypeDescription
request[HttpRequest](../../../http/request/httprequest.md?sid=django_http_request_httprequest)The incoming HTTP request object to which the current site instance will be attached.

Returns

TypeDescription
nullNothing is returned; the request object is modified in-place to include the site attribute.