December 2016
Beginner to intermediate
694 pages
14h 2m
English
Writing your own middleware is easy. Each middleware component is a single Python class that defines one or more of the following methods:
Method: process_request(request)
request is an HttpRequest object.process_request() is called on each request, before Django decides which view to execute.It should return either None or an HttpResponse object. If it returns None, Django will continue processing this request, executing any other process_request() middleware, then, process_view() middleware, and finally, the appropriate view.
If it returns an HttpResponse object, Django won't bother calling any other request, view or exception middleware, or the appropriate view; it'll apply response middleware to that ...
Read now
Unlock full access