Django Objects: HttpResponse

By: Dusty Arlia
Published on Thursday, April 24, 2014, 06:43 PM
Last Updated on Tuesday, July 07, 2015 at 10:18 PM
Total Updates: 2

The Django HttpResponse object is an instance of the HttpResponse Python class. In contrast to HttpRequest objects, which are created automatically by Django, HttpResponse objects are created by the view you create. Your view has to instantiate, populate, and return the HttpResponse object.

When a webpage is requested from your web server, Django creates an HttpRequest object that contains metadata about the HTTP request. Then Django calls the appropriate view, passing the HttpRequest as the first argument to the view function. Each view is responsible for returning an HttpResponse object. These HttpRequest objects and HttpResponse objects pass state through the system.

Comments:

Ad:

Ad: