Middleware ordering
Table 17.1 provides some hints about the ordering of various Django middleware classes:
Class |
Notes |
---|---|
UpdateCacheMiddleware |
Before those that modify the |
GZipMiddleware |
Before any middleware that may change or use the response body. After |
ConditionalGetMiddleware |
Before |
SessionMiddleware |
After |
LocaleMiddleware |
One of the topmost, after |
CommonMiddleware |
Before any middleware that may change the response (it calculates ... |
Get Mastering Django: Core 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.