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
HttpRequest represents a single HTTP request from some user-agent. All attributes except
session should be considered read-only.
All attributes should be considered read-only, unless stated otherwise.
Representing the scheme of the request (
HTML forms: binary images, XML payload etc.
It can make your code easier to move between test and deployment servers.
This is guaranteed to be uppercaseExample:
Useful if you know the form data is not in the
Representing the MIME type of the request,parsed from the
A dictionary of key/value parameters included in the
A dictionary-like object containing all given HTTP GET parameters.
If you need to access raw or non-form data posted in the request, access this through the
A dictionary containing all cookies. Keys and values are strings.
A dictionary-like object containing all uploaded files.
Each key in
Each value in
A standard Python dictionary containing all available HTTP headers.Examples:
An object of type
If the user isn’t currently logged in,
You can tell them apart with
A readable-and-writable, dictionary-like object used to represent the current session.
Only available if your Django installation has session support activated.
Not defined by Django itself, but will be read if other code (e.g., a custom middleware class) sets it.
When present, this will be used as the root URLconf for the current request, overriding the
An instance of
This attribute is only set after url resolving took place.
It’s available in all views but not in middleware methods which are executed before url resolving takes place (like
We take the vision which comes from dreams and apply the magic of science and mathematics, adding the heritage of our profession and our knowledge to create a design.