Kaydet (Commit) ae8e9738 authored tarafından Aymeric Augustin's avatar Aymeric Augustin

Fixed #12502 -- Improved middleware diagram.

üst 49519328
This diff is collapsed.
This diff is collapsed.
...@@ -32,17 +32,20 @@ created by :djadmin:`django-admin.py startproject <startproject>`:: ...@@ -32,17 +32,20 @@ created by :djadmin:`django-admin.py startproject <startproject>`::
'django.contrib.messages.middleware.MessageMiddleware', 'django.contrib.messages.middleware.MessageMiddleware',
) )
During the request phases (:meth:`process_request` and :meth:`process_view` During the request phases (:meth:`process_request` and :meth:`process_view`),
middleware), Django applies middleware in the order it's defined in Django applies middleware in the order it's defined in
:setting:`MIDDLEWARE_CLASSES`, top-down. During the response phases :setting:`MIDDLEWARE_CLASSES`, top-down. During the response phases
(:meth:`process_response` and :meth:`process_exception` middleware), the (:meth:`process_template_response`, :meth:`process_response`, and
classes are applied in reverse order, from the bottom up. You can think of it :meth:`process_exception`), the classes are applied in reverse order, from the
like an onion: each middleware class is a "layer" that wraps the view: bottom up.
.. image:: _images/middleware.png .. image:: _images/middleware.svg
:width: 502 :alt: middleware application order
:height: 417 :width: 480
:alt: Middleware application order. :height: 408
If you prefer, you can also think of it like an onion: each middleware class
is a "layer" that wraps the view.
A Django installation doesn't require any middleware -- e.g., A Django installation doesn't require any middleware -- e.g.,
:setting:`MIDDLEWARE_CLASSES` can be empty, if you'd like -- but it's strongly :setting:`MIDDLEWARE_CLASSES` can be empty, if you'd like -- but it's strongly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment