[Solved]-Which function in django creates a HttpRequest instance and hands to a view?

8👍

>>> from django.http import HttpRequest
>>> HttpRequest()
<HttpRequest
GET:{},
POST:{},
COOKIES:{},
META:{}>

If you need this for testing and emulating requests, that’s fine, but if you try to use this to call views from one another, it’s inefficient.

6👍

django.core.handlers.base.BaseHandler is responsible for sending the request through the middleware and then on to the view. The concrete handlers in django.core.handlers are what actually generate the request object in the first place.

Leave a comment