mirror of
https://github.com/django/django.git
synced 2025-10-24 06:06:09 +00:00
Fixed #24149 -- Normalized tuple settings to lists.
This commit is contained in:
@@ -31,20 +31,20 @@ First, you must add the
|
||||
:setting:`MIDDLEWARE_CLASSES` setting **after** the
|
||||
:class:`django.contrib.auth.middleware.AuthenticationMiddleware`::
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
MIDDLEWARE_CLASSES = [
|
||||
'...',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.auth.middleware.RemoteUserMiddleware',
|
||||
'...',
|
||||
)
|
||||
]
|
||||
|
||||
Next, you must replace the :class:`~django.contrib.auth.backends.ModelBackend`
|
||||
with :class:`~django.contrib.auth.backends.RemoteUserBackend` in the
|
||||
:setting:`AUTHENTICATION_BACKENDS` setting::
|
||||
|
||||
AUTHENTICATION_BACKENDS = (
|
||||
AUTHENTICATION_BACKENDS = [
|
||||
'django.contrib.auth.backends.RemoteUserBackend',
|
||||
)
|
||||
]
|
||||
|
||||
With this setup, ``RemoteUserMiddleware`` will detect the username in
|
||||
``request.META['REMOTE_USER']`` and will authenticate and auto-login that user
|
||||
|
||||
@@ -73,14 +73,14 @@ those are usually just people typing in broken URLs or broken Web 'bots).
|
||||
Put it towards the top of your :setting:`MIDDLEWARE_CLASSES` setting.
|
||||
|
||||
You can tell Django to stop reporting particular 404s by tweaking the
|
||||
:setting:`IGNORABLE_404_URLS` setting. It should be a tuple of compiled
|
||||
:setting:`IGNORABLE_404_URLS` setting. It should be a list of compiled
|
||||
regular expression objects. For example::
|
||||
|
||||
import re
|
||||
IGNORABLE_404_URLS = (
|
||||
IGNORABLE_404_URLS = [
|
||||
re.compile(r'\.(php|cgi)$'),
|
||||
re.compile(r'^/phpmyadmin/'),
|
||||
)
|
||||
]
|
||||
|
||||
In this example, a 404 to any URL ending with ``.php`` or ``.cgi`` will *not* be
|
||||
reported. Neither will any URL starting with ``/phpmyadmin/``.
|
||||
@@ -89,11 +89,11 @@ The following example shows how to exclude some conventional URLs that browsers
|
||||
crawlers often request::
|
||||
|
||||
import re
|
||||
IGNORABLE_404_URLS = (
|
||||
IGNORABLE_404_URLS = [
|
||||
re.compile(r'^/apple-touch-icon.*\.png$'),
|
||||
re.compile(r'^/favicon\.ico$'),
|
||||
re.compile(r'^/robots\.txt$'),
|
||||
)
|
||||
]
|
||||
|
||||
(Note that these are regular expressions, so we put a backslash in front of
|
||||
periods to escape them.)
|
||||
|
||||
@@ -55,10 +55,10 @@ particular app. In addition to using a ``static/`` directory inside your apps,
|
||||
you can define a list of directories (:setting:`STATICFILES_DIRS`) in your
|
||||
settings file where Django will also look for static files. For example::
|
||||
|
||||
STATICFILES_DIRS = (
|
||||
STATICFILES_DIRS = [
|
||||
os.path.join(BASE_DIR, "static"),
|
||||
'/var/www/static/',
|
||||
)
|
||||
]
|
||||
|
||||
See the documentation for the :setting:`STATICFILES_FINDERS` setting for
|
||||
details on how ``staticfiles`` finds your files.
|
||||
|
||||
Reference in New Issue
Block a user