mirror of
https://github.com/django/django.git
synced 2025-08-04 02:48:35 +00:00
Fixed #26601 -- Improved middleware per DEP 0005.
Thanks Tim Graham for polishing the patch, updating the tests, and writing documentation. Thanks Carl Meyer for shepherding the DEP.
This commit is contained in:
parent
05c888ffb8
commit
9baf692a58
81 changed files with 900 additions and 1414 deletions
|
@ -29,10 +29,10 @@ Configuration
|
|||
|
||||
First, you must add the
|
||||
:class:`django.contrib.auth.middleware.RemoteUserMiddleware` to the
|
||||
:setting:`MIDDLEWARE_CLASSES` setting **after** the
|
||||
:setting:`MIDDLEWARE` setting **after** the
|
||||
:class:`django.contrib.auth.middleware.AuthenticationMiddleware`::
|
||||
|
||||
MIDDLEWARE_CLASSES = [
|
||||
MIDDLEWARE = [
|
||||
'...',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.RemoteUserMiddleware',
|
||||
|
|
|
@ -57,7 +57,7 @@ not found" errors). Django sends emails about 404 errors when:
|
|||
|
||||
* :setting:`DEBUG` is ``False``;
|
||||
|
||||
* Your :setting:`MIDDLEWARE_CLASSES` setting includes
|
||||
* Your :setting:`MIDDLEWARE` setting includes
|
||||
:class:`django.middleware.common.BrokenLinkEmailsMiddleware`.
|
||||
|
||||
If those conditions are met, Django will email the users listed in the
|
||||
|
@ -78,7 +78,7 @@ behavior is from broken Web bots too.
|
|||
before other middleware that intercepts 404 errors, such as
|
||||
:class:`~django.middleware.locale.LocaleMiddleware` or
|
||||
:class:`~django.contrib.flatpages.middleware.FlatpageFallbackMiddleware`.
|
||||
Put it towards the top of your :setting:`MIDDLEWARE_CLASSES` setting.
|
||||
Put it towards the top of your :setting:`MIDDLEWARE` setting.
|
||||
|
||||
You can tell Django to stop reporting particular 404s by tweaking the
|
||||
:setting:`IGNORABLE_404_URLS` setting. It should be a list of compiled
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue