Appendix H. Request and Response Objects
Django uses request and response objects to pass state through the system.
When a page is requested, Django creates an HttpRequest
object that contains metadata about the request. Then Django loads the appropriate view, passing the HttpRequest
as the first argument to the view function. Each view is responsible for returning an HttpResponse
object.
We've used these objects often throughout the book; this appendix explains the complete APIs for HttpRequest
and HttpResponse
objects.
HttpRequest
HttpRequest
represents a single HTTP request from some user-agent.
Much of the important information about the request is available as attributes on the HttpRequest
instance (see Table H-1). All attributes except session ...
Get The Definitive Guide to Django: Web Development Done Right now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.