class documentation

class BaseHandler:

Known subclasses: django.core.handlers.asgi.ASGIHandler, django.core.handlers.wsgi.WSGIHandler, django.test.client.AsyncClientHandler, django.test.client.ClientHandler

View In Hierarchy

Undocumented

Method ​_get​_response Resolve and call the view, then apply view, exception, and template_response middleware. This method is everything that happens inside the request/response middleware.
Async Method ​_get​_response​_async Resolve and call the view, then apply view, exception, and template_response middleware. This method is everything that happens inside the request/response middleware.
Method adapt​_method​_mode No summary
Method check​_response Raise an error if the view returned None or an uncalled coroutine.
Method get​_response Return an HttpResponse object for the given HttpRequest.
Async Method get​_response​_async Asynchronous version of get_response.
Method load​_middleware Populate middleware lists from settings.MIDDLEWARE.
Method make​_view​_atomic Undocumented
Method process​_exception​_by​_middleware Pass the exception to the exception middleware. If no middleware return a response for this exception, return None.
Method resolve​_request Retrieve/set the urlconf for the request. Return the view resolved, with its args and kwargs.
Instance Variable ​_exception​_middleware Undocumented
Instance Variable ​_middleware​_chain Undocumented
Instance Variable ​_template​_response​_middleware Undocumented
Instance Variable ​_view​_middleware Undocumented
def _get_response(self, request):
Resolve and call the view, then apply view, exception, and template_response middleware. This method is everything that happens inside the request/response middleware.
async def _get_response_async(self, request):
Resolve and call the view, then apply view, exception, and template_response middleware. This method is everything that happens inside the request/response middleware.
def adapt_method_mode(self, is_async, method, method_is_async=None, debug=False, name=None):

Adapt a method to be in the correct "mode": - If is_async is False:

  • Synchronous methods are left alone
  • Asynchronous methods are wrapped with async_to_sync
  • If is_async is True: - Synchronous methods are wrapped with sync_to_async() - Asynchronous methods are left alone
def check_response(self, response, callback, name=None):
Raise an error if the view returned None or an uncalled coroutine.
def get_response(self, request):
Return an HttpResponse object for the given HttpRequest.
async def get_response_async(self, request):

Asynchronous version of get_response.

Funneling everything, including WSGI, into a single async get_response() is too slow. Avoid the context switch by using a separate async response path.

def load_middleware(self, is_async=False):

Populate middleware lists from settings.MIDDLEWARE.

Must be called after the environment is fixed (see __call__ in subclasses).

def make_view_atomic(self, view):

Undocumented

def process_exception_by_middleware(self, exception, request):
Pass the exception to the exception middleware. If no middleware return a response for this exception, return None.
def resolve_request(self, request):
Retrieve/set the urlconf for the request. Return the view resolved, with its args and kwargs.
_exception_middleware: list =

Undocumented

_middleware_chain =

Undocumented

_template_response_middleware: list =

Undocumented

_view_middleware: list =

Undocumented