Skip to main content

ASGIStaticFilesHandler

ASGI application which wraps another and intercepts requests for static files, passing them off to Django's static file serving.

Attributes

AttributeTypeDescription
applicationASGI applicationThe inner ASGI application instance that this handler wraps and delegates non-static requests to.
base_urlParseResultThe parsed URL components of the static files base path used to determine if an incoming request should be intercepted for static file serving.

Constructor

Signature

def ASGIStaticFilesHandler(
application: ASGI application
) - > null

Parameters

NameTypeDescription
applicationASGI applicationThe inner ASGI application to wrap.

Methods


get_response_async()

@classmethod
def get_response_async(
request: [HttpRequest](../../../http/request/httprequest.md?sid=django_http_request_httprequest)
) - > [HttpResponse](../../../http/response/httpresponse.md?sid=django_http_response_httpresponse)

Asynchronously retrieves a response for a request and ensures that synchronous FileResponses are wrapped for compatibility with async streaming.

Parameters

NameTypeDescription
request[HttpRequest](../../../http/request/httprequest.md?sid=django_http_request_httprequest)The Django request object being processed for a static file resource.

Returns

TypeDescription
[HttpResponse](../../../http/response/httpresponse.md?sid=django_http_response_httpresponse)The processed response object, potentially modified with an async-compatible streaming content wrapper.