'`.dispatch()` is pretty much the same as Django\'s regular dispatch,
but with extra hooks for startup, finalize, and exception handling.'

def dispatch(self, request, *args, **kwargs):

    self.args = args
    self.kwargs = kwargs
    request = self.initialize_request(request, *args, **kwargs)
    self.request = request
    self.headers = self.default_response_headers
    try:
        self.initial(request, *args, **kwargs)
        if (request.method.lower() in self.http_method_names):
            handler = getattr(self, request.method.lower(), self.http_method_not_allowed)
        else:
            handler = self.http_method_not_allowed
        response = handler(request, *args, **kwargs)
    except Exception as exc:
        response = self.handle_exception(exc)
    self.response = self.finalize_response(request, response, *args, **kwargs)
    return self.response
