Available middleware
Cache middleware
django.middleware.cache.UpdateCacheMiddleware
; and django.middleware.cache.FetchFromCacheMiddleware
Enable the site-wide cache. If these are enabled, each Django-powered page will be cached for as long as the CACHE_MIDDLEWARE_SECONDS
setting defines. See the cache documentation.
Common middleware
django.middleware.common.CommonMiddleware
Adds a few conveniences for perfectionists:
- Forbids access to user agents in the
DISALLOWED_USER_AGENTS
setting, which should be a list of compiled regular expression objects. - Performs URL rewriting based on the
APPEND_SLASH
andPREPEND_WWW
settings. - If
APPEND_SLASH
isTrue
and the initial URL doesn't end with a slash, and it is not found in the URLconf, then a new URL is formed ...
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.