~ubuntu-branches/ubuntu/oneiric/python-django/oneiric-security

« back to all changes in this revision

Viewing changes to .pc/add_allowed_hosts.patch/docs/ref/settings.txt

  • Committer: Package Import Robot
  • Author(s): Marc Deslauriers
  • Date: 2013-03-04 10:33:54 UTC
  • Revision ID: package-import@ubuntu.com-20130304103354-d59rx3ujfa11an1k
Tags: 1.3-2ubuntu1.6
* SECURITY UPDATE: host header poisoning (LP: #1089337)
  - debian/patches/fix_get_host.patch: tighten host header validation in
    django/http/__init__.py, add tests to
    tests/regressiontests/requests/tests.py.
  - https://www.djangoproject.com/weblog/2012/dec/10/security/
  - No CVE number
* SECURITY UPDATE: redirect poisoning (LP: #1089337)
  - debian/patches/fix_redirect_poisoning.patch: tighten validation in
    django/contrib/auth/views.py,
    django/contrib/comments/views/comments.py,
    django/contrib/comments/views/moderation.py,
    django/contrib/comments/views/utils.py, django/utils/http.py,
    django/views/i18n.py, add tests to
    tests/regressiontests/comment_tests/tests/comment_view_tests.py,
    tests/regressiontests/comment_tests/tests/moderation_view_tests.py,
    tests/regressiontests/views/tests/i18n.py.
  - https://www.djangoproject.com/weblog/2012/dec/10/security/
  - No CVE number
* SECURITY UPDATE: host header poisoning (LP: #1130445)
  - debian/patches/add_allowed_hosts.patch: add new ALLOWED_HOSTS setting
    to django/conf/global_settings.py,
    django/conf/project_template/settings.py,
    django/http/__init__.py, django/test/utils.py, add docs to
    docs/ref/settings.txt, add tests to
    tests/regressiontests/requests/tests.py.
  - https://www.djangoproject.com/weblog/2013/feb/19/security/
  - No CVE number
* SECURITY UPDATE: XML attacks (LP: #1130445)
  - debian/patches/CVE-2013-166x.patch: forbid DTDs, entity expansion,
    and external entities/DTDs in
    django/core/serializers/xml_serializer.py, add tests to
    tests/regressiontests/serializers_regress/tests.py.
  - https://www.djangoproject.com/weblog/2013/feb/19/security/
  - CVE-2013-1664
  - CVE-2013-1665
* SECURITY UPDATE: Data leakage via admin history log (LP: #1130445)
  - debian/patches/CVE-2013-0305.patch: add permission checks to history
    view in django/contrib/admin/options.py, add tests to
    tests/regressiontests/admin_views/tests.py.
  - https://www.djangoproject.com/weblog/2013/feb/19/security/
  - CVE-2013-0305
* SECURITY UPDATE: Formset denial-of-service (LP: #1130445)
  - debian/patches/CVE-2013-0306.patch: limit maximum number of forms in
    django/forms/formsets.py, add docs to docs/topics/forms/formsets.txt,
    docs/topics/forms/modelforms.txt, add tests to
    tests/regressiontests/forms/tests/formsets.py.
  - https://www.djangoproject.com/weblog/2013/feb/19/security/
  - CVE-2013-0306

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
========
 
2
Settings
 
3
========
 
4
 
 
5
.. contents::
 
6
    :local:
 
7
    :depth: 1
 
8
 
 
9
Available settings
 
10
==================
 
11
 
 
12
Here's a full list of all available settings, in alphabetical order, and their
 
13
default values.
 
14
 
 
15
.. setting:: ABSOLUTE_URL_OVERRIDES
 
16
 
 
17
ABSOLUTE_URL_OVERRIDES
 
18
----------------------
 
19
 
 
20
Default: ``{}`` (Empty dictionary)
 
21
 
 
22
A dictionary mapping ``"app_label.model_name"`` strings to functions that take
 
23
a model object and return its URL. This is a way of overriding
 
24
``get_absolute_url()`` methods on a per-installation basis. Example::
 
25
 
 
26
    ABSOLUTE_URL_OVERRIDES = {
 
27
        'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
 
28
        'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
 
29
    }
 
30
 
 
31
Note that the model name used in this setting should be all lower-case, regardless
 
32
of the case of the actual model class name.
 
33
 
 
34
.. setting:: ADMIN_FOR
 
35
 
 
36
ADMIN_FOR
 
37
---------
 
38
 
 
39
Default: ``()`` (Empty tuple)
 
40
 
 
41
Used for admin-site settings modules, this should be a tuple of settings
 
42
modules (in the format ``'foo.bar.baz'``) for which this site is an admin.
 
43
 
 
44
The admin site uses this in its automatically-introspected documentation of
 
45
models, views and template tags.
 
46
 
 
47
.. setting:: ADMIN_MEDIA_PREFIX
 
48
 
 
49
ADMIN_MEDIA_PREFIX
 
50
------------------
 
51
 
 
52
Default: ``'/static/admin/'``
 
53
 
 
54
The URL prefix for admin media -- CSS, JavaScript and images used by the Django
 
55
administrative interface. Make sure to use a trailing slash, and to have this be
 
56
different from the :setting:`MEDIA_URL` setting (since the same URL cannot be
 
57
mapped onto two different sets of files). For integration with :doc:`staticfiles
 
58
</ref/contrib/staticfiles>`, this should be the same as
 
59
:setting:`STATIC_URL` followed by ``'admin/'``.
 
60
 
 
61
.. setting:: ADMINS
 
62
 
 
63
ADMINS
 
64
------
 
65
 
 
66
Default: ``()`` (Empty tuple)
 
67
 
 
68
A tuple that lists people who get code error notifications. When
 
69
``DEBUG=False`` and a view raises an exception, Django will e-mail these people
 
70
with the full exception information. Each member of the tuple should be a tuple
 
71
of (Full name, e-mail address). Example::
 
72
 
 
73
    (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
 
74
 
 
75
Note that Django will e-mail *all* of these people whenever an error happens.
 
76
See :doc:`/howto/error-reporting` for more information.
 
77
 
 
78
.. setting:: ALLOWED_INCLUDE_ROOTS
 
79
 
 
80
ALLOWED_INCLUDE_ROOTS
 
81
---------------------
 
82
 
 
83
Default: ``()`` (Empty tuple)
 
84
 
 
85
A tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
 
86
tag. This is a security measure, so that template authors can't access files
 
87
that they shouldn't be accessing.
 
88
 
 
89
For example, if ``ALLOWED_INCLUDE_ROOTS`` is ``('/home/html', '/var/www')``,
 
90
then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
 
91
wouldn't.
 
92
 
 
93
.. setting:: APPEND_SLASH
 
94
 
 
95
APPEND_SLASH
 
96
------------
 
97
 
 
98
Default: ``True``
 
99
 
 
100
When set to ``True``, if the request URL does not match any of the patterns
 
101
in the URLconf and it doesn't end in a slash, an HTTP redirect is issued to the
 
102
same URL with a slash appended. Note that the redirect may cause any data
 
103
submitted in a POST request to be lost.
 
104
 
 
105
The ``APPEND_SLASH`` setting is only used if
 
106
:class:`~django.middleware.common.CommonMiddleware` is installed
 
107
(see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`.
 
108
 
 
109
.. setting:: AUTHENTICATION_BACKENDS
 
110
 
 
111
AUTHENTICATION_BACKENDS
 
112
-----------------------
 
113
 
 
114
Default: ``('django.contrib.auth.backends.ModelBackend',)``
 
115
 
 
116
A tuple of authentication backend classes (as strings) to use when attempting to
 
117
authenticate a user. See the :doc:`authentication backends documentation
 
118
</ref/authbackends>` for details.
 
119
 
 
120
.. setting:: AUTH_PROFILE_MODULE
 
121
 
 
122
AUTH_PROFILE_MODULE
 
123
-------------------
 
124
 
 
125
Default: Not defined
 
126
 
 
127
The site-specific user profile model used by this site. See
 
128
:ref:`auth-profiles`.
 
129
 
 
130
.. setting:: CACHES
 
131
 
 
132
CACHES
 
133
------
 
134
 
 
135
.. versionadded:: 1.3
 
136
 
 
137
Default::
 
138
 
 
139
    {
 
140
        'default': {
 
141
            'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
 
142
        }
 
143
    }
 
144
 
 
145
A dictionary containing the settings for all caches to be used with
 
146
Django. It is a nested dictionary whose contents maps cache aliases
 
147
to a dictionary containing the options for an individual cache.
 
148
 
 
149
The :setting:`CACHES` setting must configure a ``default`` cache;
 
150
any number of additional caches may also be specified. If you
 
151
are using a cache backend other than the local memory cache, or
 
152
you need to define multiple caches, other options will be required.
 
153
The following cache options are available.
 
154
 
 
155
.. setting:: CACHES-BACKEND
 
156
 
 
157
BACKEND
 
158
~~~~~~~
 
159
 
 
160
Default: ``''`` (Empty string)
 
161
 
 
162
The cache backend to use. The built-in cache backends are:
 
163
 
 
164
    * ``'django.core.cache.backends.db.DatabaseCache'``
 
165
    * ``'django.core.cache.backends.dummy.DummyCache'``
 
166
    * ``'django.core.cache.backends.filebased.FileBasedCache'``
 
167
    * ``'django.core.cache.backends.locmem.LocMemCache'``
 
168
    * ``'django.core.cache.backends.memcached.MemcachedCache'``
 
169
    * ``'django.core.cache.backends.memcached.PyLibMCCache'``
 
170
 
 
171
You can use a cache backend that doesn't ship with Django by setting
 
172
:setting:`BACKEND <CACHE-BACKEND>` to a fully-qualified path of a cache
 
173
backend class (i.e. ``mypackage.backends.whatever.WhateverCache``).
 
174
Writing a whole new cache backend from scratch is left as an exercise
 
175
to the reader; see the other backends for examples.
 
176
 
 
177
.. note::
 
178
    Prior to Django 1.3, you could use a URI based version of the backend
 
179
    name to reference the built-in cache backends (e.g., you could use
 
180
    ``'db://tablename'`` to refer to the database backend). This format has
 
181
    been deprecated, and will be removed in Django 1.5.
 
182
 
 
183
.. setting:: CACHES-KEY_FUNCTION
 
184
 
 
185
KEY_FUNCTION
 
186
~~~~~~~~~~~~
 
187
 
 
188
A string containing a dotted path to a function that defines how to
 
189
compose a prefix, version and key into a final cache key. The default
 
190
implementation is equivalent to the function::
 
191
 
 
192
    def make_key(key, key_prefix, version):
 
193
        return ':'.join([key_prefix, str(version), smart_str(key)])
 
194
 
 
195
You may use any key function you want, as long as it has the same
 
196
argument signature.
 
197
 
 
198
See the :ref:`cache documentation <cache_key_transformation>` for more information.
 
199
 
 
200
.. setting:: CACHES-KEY_PREFIX
 
201
 
 
202
KEY_PREFIX
 
203
~~~~~~~~~~
 
204
 
 
205
Default: ``''`` (Empty string)
 
206
 
 
207
A string that will be automatically included (prepended by default) to
 
208
all cache keys used by the Django server.
 
209
 
 
210
See the :ref:`cache documentation <cache_key_prefixing>` for more information.
 
211
 
 
212
.. setting:: CACHES-LOCATION
 
213
 
 
214
LOCATION
 
215
~~~~~~~~
 
216
 
 
217
Default: ``''`` (Empty string)
 
218
 
 
219
The location of the cache to use. This might be the directory for a
 
220
file system cache, a host and port for a memcache server, or simply an
 
221
identifying name for a local memory cache. e.g.::
 
222
 
 
223
    CACHES = {
 
224
        'default': {
 
225
            'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
 
226
            'LOCATION': '/var/tmp/django_cache',
 
227
        }
 
228
    }
 
229
 
 
230
.. setting:: CACHES-OPTIONS
 
231
 
 
232
OPTIONS
 
233
~~~~~~~
 
234
 
 
235
Default: None
 
236
 
 
237
Extra parameters to pass to the cache backend. Available parameters
 
238
vary depending on your cache backend.
 
239
 
 
240
Some information on available parameters can be found in the
 
241
:doc:`Cache Backends </topics/cache>` documentation. For more information,
 
242
consult your backend module's own documentation.
 
243
 
 
244
.. setting:: CACHES-TIMEOUT
 
245
 
 
246
TIMEOUT
 
247
~~~~~~~
 
248
 
 
249
Default: 300
 
250
 
 
251
The number of seconds before a cache entry is considered stale.
 
252
 
 
253
.. setting:: CACHES-VERSION
 
254
 
 
255
VERSION
 
256
~~~~~~~
 
257
 
 
258
Default: ``1``
 
259
 
 
260
The default version number for cache keys generated by the Django server.
 
261
 
 
262
See the :ref:`cache documentation <cache_versioning>` for more information.
 
263
 
 
264
.. setting:: CACHE_MIDDLEWARE_ALIAS
 
265
 
 
266
CACHE_MIDDLEWARE_ALIAS
 
267
----------------------
 
268
 
 
269
Default: ``default``
 
270
 
 
271
The cache connection to use for the cache middleware.
 
272
 
 
273
.. setting:: CACHE_MIDDLEWARE_ANONYMOUS_ONLY
 
274
 
 
275
CACHE_MIDDLEWARE_ANONYMOUS_ONLY
 
276
-------------------------------
 
277
 
 
278
Default: ``False``
 
279
 
 
280
If the value of this setting is ``True``, only anonymous requests (i.e., not
 
281
those made by a logged-in user) will be cached.  Otherwise, the middleware
 
282
caches every page that doesn't have GET or POST parameters.
 
283
 
 
284
If you set the value of this setting to ``True``, you should make sure you've
 
285
activated ``AuthenticationMiddleware``.
 
286
 
 
287
See :doc:`/topics/cache`.
 
288
 
 
289
.. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
 
290
 
 
291
CACHE_MIDDLEWARE_KEY_PREFIX
 
292
---------------------------
 
293
 
 
294
Default: ``''`` (Empty string)
 
295
 
 
296
The cache key prefix that the cache middleware should use.
 
297
 
 
298
See :doc:`/topics/cache`.
 
299
 
 
300
.. setting:: CACHE_MIDDLEWARE_SECONDS
 
301
 
 
302
CACHE_MIDDLEWARE_SECONDS
 
303
------------------------
 
304
 
 
305
Default: ``600``
 
306
 
 
307
The default number of seconds to cache a page when the caching middleware or
 
308
``cache_page()`` decorator is used.
 
309
 
 
310
See :doc:`/topics/cache`.
 
311
 
 
312
.. setting:: CSRF_COOKIE_DOMAIN
 
313
 
 
314
CSRF_COOKIE_DOMAIN
 
315
------------------
 
316
 
 
317
.. versionadded:: 1.2
 
318
 
 
319
Default: ``None``
 
320
 
 
321
The domain to be used when setting the CSRF cookie.  This can be useful for
 
322
allowing cross-subdomain requests to be exluded from the normal cross site
 
323
request forgery protection.  It should be set to a string such as
 
324
``".lawrence.com"`` to allow a POST request from a form on one subdomain to be
 
325
accepted by accepted by a view served from another subdomain.
 
326
 
 
327
.. setting:: CSRF_COOKIE_NAME
 
328
 
 
329
CSRF_COOKIE_NAME
 
330
----------------
 
331
 
 
332
.. versionadded:: 1.2
 
333
 
 
334
Default: ``'csrftoken'``
 
335
 
 
336
The name of the cookie to use for the CSRF authentication token. This can be whatever you
 
337
want.  See :doc:`/ref/contrib/csrf`.
 
338
 
 
339
.. setting:: CSRF_FAILURE_VIEW
 
340
 
 
341
CSRF_FAILURE_VIEW
 
342
-----------------
 
343
 
 
344
.. versionadded:: 1.2
 
345
 
 
346
Default: ``'django.views.csrf.csrf_failure'``
 
347
 
 
348
A dotted path to the view function to be used when an incoming request
 
349
is rejected by the CSRF protection.  The function should have this signature::
 
350
 
 
351
  def csrf_failure(request, reason="")
 
352
 
 
353
where ``reason`` is a short message (intended for developers or logging, not for
 
354
end users) indicating the reason the request was rejected.  See
 
355
:doc:`/ref/contrib/csrf`.
 
356
 
 
357
 
 
358
.. setting:: DATABASES
 
359
 
 
360
DATABASES
 
361
---------
 
362
 
 
363
.. versionadded:: 1.2
 
364
 
 
365
Default: ``{}`` (Empty dictionary)
 
366
 
 
367
A dictionary containing the settings for all databases to be used with
 
368
Django. It is a nested dictionary whose contents maps database aliases
 
369
to a dictionary containing the options for an individual database.
 
370
 
 
371
The :setting:`DATABASES` setting must configure a ``default`` database;
 
372
any number of additional databases may also be specified.
 
373
 
 
374
The simplest possible settings file is for a single-database setup using
 
375
SQLite. This can be configured using the following::
 
376
 
 
377
    DATABASES = {
 
378
        'default': {
 
379
            'ENGINE': 'django.db.backends.sqlite3',
 
380
            'NAME': 'mydatabase'
 
381
        }
 
382
    }
 
383
 
 
384
For other database backends, or more complex SQLite configurations, other options
 
385
will be required. The following inner options are available.
 
386
 
 
387
.. setting:: DATABASE-ENGINE
 
388
 
 
389
ENGINE
 
390
~~~~~~
 
391
 
 
392
Default: ``''`` (Empty string)
 
393
 
 
394
The database backend to use. The built-in database backends are:
 
395
 
 
396
    * ``'django.db.backends.postgresql_psycopg2'``
 
397
    * ``'django.db.backends.postgresql'``
 
398
    * ``'django.db.backends.mysql'``
 
399
    * ``'django.db.backends.sqlite3'``
 
400
    * ``'django.db.backends.oracle'``
 
401
 
 
402
You can use a database backend that doesn't ship with Django by setting
 
403
``ENGINE`` to a fully-qualified path (i.e.
 
404
``mypackage.backends.whatever``). Writing a whole new database backend from
 
405
scratch is left as an exercise to the reader; see the other backends for
 
406
examples.
 
407
 
 
408
.. note::
 
409
    Prior to Django 1.2, you could use a short version of the backend name
 
410
    to reference the built-in database backends (e.g., you could use
 
411
    ``'sqlite3'`` to refer to the SQLite backend). This format has been
 
412
    deprecated, and will be removed in Django 1.4.
 
413
 
 
414
.. setting:: HOST
 
415
 
 
416
HOST
 
417
~~~~
 
418
 
 
419
Default: ``''`` (Empty string)
 
420
 
 
421
Which host to use when connecting to the database. An empty string means
 
422
localhost. Not used with SQLite.
 
423
 
 
424
If this value starts with a forward slash (``'/'``) and you're using MySQL,
 
425
MySQL will connect via a Unix socket to the specified socket. For example::
 
426
 
 
427
    "HOST": '/var/run/mysql'
 
428
 
 
429
If you're using MySQL and this value *doesn't* start with a forward slash, then
 
430
this value is assumed to be the host.
 
431
 
 
432
If you're using PostgreSQL, an empty string means to use a Unix domain socket
 
433
for the connection, rather than a network connection to localhost. If you
 
434
explicitly need to use a TCP/IP connection on the local machine with
 
435
PostgreSQL, specify ``localhost`` here.
 
436
 
 
437
.. setting:: NAME
 
438
 
 
439
NAME
 
440
~~~~
 
441
 
 
442
Default: ``''`` (Empty string)
 
443
 
 
444
The name of the database to use. For SQLite, it's the full path to the database
 
445
file. When specifying the path, always use forward slashes, even on Windows
 
446
(e.g. ``C:/homes/user/mysite/sqlite3.db``).
 
447
 
 
448
.. setting:: OPTIONS
 
449
 
 
450
OPTIONS
 
451
~~~~~~~
 
452
 
 
453
Default: ``{}`` (Empty dictionary)
 
454
 
 
455
Extra parameters to use when connecting to the database. Available parameters
 
456
vary depending on your database backend.
 
457
 
 
458
Some information on available parameters can be found in the
 
459
:doc:`Database Backends </ref/databases>` documentation. For more information,
 
460
consult your backend module's own documentation.
 
461
 
 
462
.. setting:: PASSWORD
 
463
 
 
464
PASSWORD
 
465
~~~~~~~~
 
466
 
 
467
Default: ``''`` (Empty string)
 
468
 
 
469
The password to use when connecting to the database. Not used with SQLite.
 
470
 
 
471
.. setting:: PORT
 
472
 
 
473
PORT
 
474
~~~~
 
475
 
 
476
Default: ``''`` (Empty string)
 
477
 
 
478
The port to use when connecting to the database. An empty string means the
 
479
default port. Not used with SQLite.
 
480
 
 
481
.. setting:: USER
 
482
 
 
483
USER
 
484
~~~~
 
485
 
 
486
Default: ``''`` (Empty string)
 
487
 
 
488
The username to use when connecting to the database. Not used with SQLite.
 
489
 
 
490
.. setting:: TEST_CHARSET
 
491
 
 
492
TEST_CHARSET
 
493
~~~~~~~~~~~~
 
494
 
 
495
Default: ``None``
 
496
 
 
497
The character set encoding used to create the test database. The value of this
 
498
string is passed directly through to the database, so its format is
 
499
backend-specific.
 
500
 
 
501
Supported for the PostgreSQL_ (``postgresql``, ``postgresql_psycopg2``) and
 
502
MySQL_ (``mysql``) backends.
 
503
 
 
504
.. _PostgreSQL: http://www.postgresql.org/docs/8.2/static/multibyte.html
 
505
.. _MySQL: http://dev.mysql.com/doc/refman/5.0/en/charset-database.html
 
506
 
 
507
.. setting:: TEST_COLLATION
 
508
 
 
509
TEST_COLLATION
 
510
~~~~~~~~~~~~~~
 
511
 
 
512
Default: ``None``
 
513
 
 
514
The collation order to use when creating the test database. This value is
 
515
passed directly to the backend, so its format is backend-specific.
 
516
 
 
517
Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
 
518
 
 
519
.. _MySQL manual: MySQL_
 
520
 
 
521
.. setting:: TEST_DEPENDENCIES
 
522
 
 
523
TEST_DEPENDENCIES
 
524
~~~~~~~~~~~~~~~~~
 
525
 
 
526
.. versionadded:: 1.3
 
527
 
 
528
Default: ``['default']``, for all databases other than ``default``,
 
529
which has no dependencies.
 
530
 
 
531
The creation-order dependencies of the database. See the documentation
 
532
on :ref:`controlling the creation order of test databases
 
533
<topics-testing-creation-dependencies>` for details.
 
534
 
 
535
.. setting:: TEST_MIRROR
 
536
 
 
537
TEST_MIRROR
 
538
~~~~~~~~~~~
 
539
 
 
540
Default: ``None``
 
541
 
 
542
The alias of the database that this database should mirror during
 
543
testing.
 
544
 
 
545
This setting exists to allow for testing of master/slave
 
546
configurations of multiple databases. See the documentation on
 
547
:ref:`testing master/slave configurations
 
548
<topics-testing-masterslave>` for details.
 
549
 
 
550
.. setting:: TEST_NAME
 
551
 
 
552
TEST_NAME
 
553
~~~~~~~~~
 
554
 
 
555
Default: ``None``
 
556
 
 
557
The name of database to use when running the test suite.
 
558
 
 
559
If the default value (``None``) is used with the SQLite database engine, the
 
560
tests will use a memory resident database. For all other database engines the
 
561
test database will use the name ``'test_' + DATABASE_NAME``.
 
562
 
 
563
See :doc:`/topics/testing`.
 
564
 
 
565
.. setting:: TEST_USER
 
566
 
 
567
TEST_USER
 
568
~~~~~~~~~
 
569
 
 
570
Default: ``None``
 
571
 
 
572
This is an Oracle-specific setting.
 
573
 
 
574
The username to use when connecting to the Oracle database that will be used
 
575
when running tests.
 
576
 
 
577
.. setting:: DATABASE_ROUTERS
 
578
 
 
579
DATABASE_ROUTERS
 
580
----------------
 
581
 
 
582
.. versionadded:: 1.2
 
583
 
 
584
Default: ``[]`` (Empty list)
 
585
 
 
586
The list of routers that will be used to determine which database
 
587
to use when performing a database queries.
 
588
 
 
589
See the documentation on :ref:`automatic database routing in multi
 
590
database configurations <topics-db-multi-db-routing>`.
 
591
 
 
592
.. setting:: DATE_FORMAT
 
593
 
 
594
DATE_FORMAT
 
595
-----------
 
596
 
 
597
Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
 
598
 
 
599
The default formatting to use for displaying date fields in any part of the
 
600
system. Note that if :setting:`USE_L10N` is set to ``True``, then the
 
601
locale-dictated format has higher precedence and will be applied instead. See
 
602
:tfilter:`allowed date format strings <date>`.
 
603
 
 
604
.. versionchanged:: 1.2
 
605
    This setting can now be overriden by setting ``USE_L10N`` to ``True``.
 
606
 
 
607
See also ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATE_FORMAT``.
 
608
 
 
609
.. setting:: DATE_INPUT_FORMATS
 
610
 
 
611
DATE_INPUT_FORMATS
 
612
------------------
 
613
 
 
614
.. versionadded:: 1.2
 
615
 
 
616
Default::
 
617
 
 
618
    ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
 
619
    '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
 
620
    '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
 
621
 
 
622
A tuple of formats that will be accepted when inputting data on a date
 
623
field. Formats will be tried in order, using the first valid.
 
624
Note that these format strings are specified in Python's datetime_ module
 
625
syntax, that is different from the one used by Django for formatting dates
 
626
to be displayed.
 
627
 
 
628
See also ``DATETIME_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
 
629
 
 
630
.. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
 
631
 
 
632
.. setting:: DATETIME_FORMAT
 
633
 
 
634
DATETIME_FORMAT
 
635
---------------
 
636
 
 
637
Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
 
638
 
 
639
The default formatting to use for displaying datetime fields in any part of the
 
640
system. Note that if :setting:`USE_L10N` is set to ``True``, then the
 
641
locale-dictated format has higher precedence and will be applied instead. See
 
642
:tfilter:`allowed date format strings <date>`.
 
643
 
 
644
.. versionchanged:: 1.2
 
645
    This setting can now be overriden by setting ``USE_L10N`` to ``True``.
 
646
 
 
647
See also ``DATE_FORMAT``, ``TIME_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
 
648
 
 
649
.. setting:: DATETIME_INPUT_FORMATS
 
650
 
 
651
DATETIME_INPUT_FORMATS
 
652
----------------------
 
653
 
 
654
.. versionadded:: 1.2
 
655
 
 
656
Default::
 
657
 
 
658
    ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
 
659
    '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
 
660
    '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
 
661
 
 
662
A tuple of formats that will be accepted when inputting data on a datetime
 
663
field. Formats will be tried in order, using the first valid.
 
664
Note that these format strings are specified in Python's datetime_ module
 
665
syntax, that is different from the one used by Django for formatting dates
 
666
to be displayed.
 
667
 
 
668
See also ``DATE_INPUT_FORMATS`` and ``TIME_INPUT_FORMATS``.
 
669
 
 
670
.. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
 
671
 
 
672
.. setting:: DEBUG
 
673
 
 
674
DEBUG
 
675
-----
 
676
 
 
677
Default: ``False``
 
678
 
 
679
A boolean that turns on/off debug mode.
 
680
 
 
681
If you define custom settings, `django/views/debug.py`_ has a ``HIDDEN_SETTINGS``
 
682
regular expression which will hide from the DEBUG view anything that contains
 
683
``'SECRET'``, ``'PASSWORD'``, ``'PROFANITIES'``, or ``'SIGNATURE'``. This allows
 
684
untrusted users to be able to give backtraces without seeing sensitive (or
 
685
offensive) settings.
 
686
 
 
687
Still, note that there are always going to be sections of your debug output that
 
688
are inappropriate for public consumption. File paths, configuration options, and
 
689
the like all give attackers extra information about your server.
 
690
 
 
691
It is also important to remember that when running with ``DEBUG`` turned on, Django
 
692
will remember every SQL query it executes. This is useful when you are debugging,
 
693
but on a production server, it will rapidly consume memory.
 
694
 
 
695
Never deploy a site into production with ``DEBUG`` turned on.
 
696
 
 
697
.. _django/views/debug.py: http://code.djangoproject.com/browser/django/trunk/django/views/debug.py
 
698
 
 
699
DEBUG_PROPAGATE_EXCEPTIONS
 
700
--------------------------
 
701
 
 
702
Default: ``False``
 
703
 
 
704
If set to True, Django's normal exception handling of view functions
 
705
will be suppressed, and exceptions will propagate upwards.  This can
 
706
be useful for some test setups, and should never be used on a live
 
707
site.
 
708
 
 
709
.. setting:: DECIMAL_SEPARATOR
 
710
 
 
711
DECIMAL_SEPARATOR
 
712
-----------------
 
713
 
 
714
.. versionadded:: 1.2
 
715
 
 
716
Default: ``'.'`` (Dot)
 
717
 
 
718
Default decimal separator used when formatting decimal numbers.
 
719
 
 
720
.. setting:: DEFAULT_CHARSET
 
721
 
 
722
DEFAULT_CHARSET
 
723
---------------
 
724
 
 
725
Default: ``'utf-8'``
 
726
 
 
727
Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
 
728
manually specified. Used with ``DEFAULT_CONTENT_TYPE`` to construct the
 
729
``Content-Type`` header.
 
730
 
 
731
.. setting:: DEFAULT_CONTENT_TYPE
 
732
 
 
733
DEFAULT_CONTENT_TYPE
 
734
--------------------
 
735
 
 
736
Default: ``'text/html'``
 
737
 
 
738
Default content type to use for all ``HttpResponse`` objects, if a MIME type
 
739
isn't manually specified. Used with ``DEFAULT_CHARSET`` to construct the
 
740
``Content-Type`` header.
 
741
 
 
742
.. setting:: DEFAULT_FILE_STORAGE
 
743
 
 
744
DEFAULT_FILE_STORAGE
 
745
--------------------
 
746
 
 
747
Default: :class:`django.core.files.storage.FileSystemStorage`
 
748
 
 
749
Default file storage class to be used for any file-related operations that don't
 
750
specify a particular storage system. See :doc:`/topics/files`.
 
751
 
 
752
.. setting:: DEFAULT_FROM_EMAIL
 
753
 
 
754
DEFAULT_FROM_EMAIL
 
755
------------------
 
756
 
 
757
Default: ``'webmaster@localhost'``
 
758
 
 
759
Default e-mail address to use for various automated correspondence from the
 
760
site manager(s).
 
761
 
 
762
.. setting:: DEFAULT_INDEX_TABLESPACE
 
763
 
 
764
DEFAULT_INDEX_TABLESPACE
 
765
------------------------
 
766
 
 
767
Default: ``''`` (Empty string)
 
768
 
 
769
Default tablespace to use for indexes on fields that don't specify
 
770
one, if the backend supports it.
 
771
 
 
772
.. setting:: DEFAULT_TABLESPACE
 
773
 
 
774
DEFAULT_TABLESPACE
 
775
------------------
 
776
 
 
777
Default: ``''`` (Empty string)
 
778
 
 
779
Default tablespace to use for models that don't specify one, if the
 
780
backend supports it.
 
781
 
 
782
.. setting:: DISALLOWED_USER_AGENTS
 
783
 
 
784
DISALLOWED_USER_AGENTS
 
785
----------------------
 
786
 
 
787
Default: ``()`` (Empty tuple)
 
788
 
 
789
List of compiled regular expression objects representing User-Agent strings that
 
790
are not allowed to visit any page, systemwide. Use this for bad robots/crawlers.
 
791
This is only used if ``CommonMiddleware`` is installed (see
 
792
:doc:`/topics/http/middleware`).
 
793
 
 
794
.. setting:: EMAIL_BACKEND
 
795
 
 
796
EMAIL_BACKEND
 
797
-------------
 
798
 
 
799
.. versionadded:: 1.2
 
800
 
 
801
Default: ``'django.core.mail.backends.smtp.EmailBackend'``
 
802
 
 
803
The backend to use for sending emails. For the list of available backends see
 
804
:doc:`/topics/email`.
 
805
 
 
806
.. setting:: EMAIL_FILE_PATH
 
807
 
 
808
EMAIL_FILE_PATH
 
809
---------------
 
810
 
 
811
.. versionadded:: 1.2
 
812
 
 
813
Default: Not defined
 
814
 
 
815
The directory used by the ``file`` email backend to store output files.
 
816
 
 
817
.. setting:: EMAIL_HOST
 
818
 
 
819
EMAIL_HOST
 
820
----------
 
821
 
 
822
Default: ``'localhost'``
 
823
 
 
824
The host to use for sending e-mail.
 
825
 
 
826
See also ``EMAIL_PORT``.
 
827
 
 
828
.. setting:: EMAIL_HOST_PASSWORD
 
829
 
 
830
EMAIL_HOST_PASSWORD
 
831
-------------------
 
832
 
 
833
Default: ``''`` (Empty string)
 
834
 
 
835
Password to use for the SMTP server defined in ``EMAIL_HOST``. This setting is
 
836
used in conjunction with ``EMAIL_HOST_USER`` when authenticating to the SMTP
 
837
server. If either of these settings is empty, Django won't attempt
 
838
authentication.
 
839
 
 
840
See also ``EMAIL_HOST_USER``.
 
841
 
 
842
.. setting:: EMAIL_HOST_USER
 
843
 
 
844
EMAIL_HOST_USER
 
845
---------------
 
846
 
 
847
Default: ``''`` (Empty string)
 
848
 
 
849
Username to use for the SMTP server defined in ``EMAIL_HOST``. If empty,
 
850
Django won't attempt authentication.
 
851
 
 
852
See also ``EMAIL_HOST_PASSWORD``.
 
853
 
 
854
.. setting:: EMAIL_PORT
 
855
 
 
856
EMAIL_PORT
 
857
----------
 
858
 
 
859
Default: ``25``
 
860
 
 
861
Port to use for the SMTP server defined in ``EMAIL_HOST``.
 
862
 
 
863
.. setting:: EMAIL_SUBJECT_PREFIX
 
864
 
 
865
EMAIL_SUBJECT_PREFIX
 
866
--------------------
 
867
 
 
868
Default: ``'[Django] '``
 
869
 
 
870
Subject-line prefix for e-mail messages sent with ``django.core.mail.mail_admins``
 
871
or ``django.core.mail.mail_managers``. You'll probably want to include the
 
872
trailing space.
 
873
 
 
874
.. setting:: EMAIL_USE_TLS
 
875
 
 
876
EMAIL_USE_TLS
 
877
-------------
 
878
 
 
879
Default: ``False``
 
880
 
 
881
Whether to use a TLS (secure) connection when talking to the SMTP server.
 
882
 
 
883
.. setting:: FILE_CHARSET
 
884
 
 
885
FILE_CHARSET
 
886
------------
 
887
 
 
888
Default: ``'utf-8'``
 
889
 
 
890
The character encoding used to decode any files read from disk. This includes
 
891
template files and initial SQL data files.
 
892
 
 
893
.. setting:: FILE_UPLOAD_HANDLERS
 
894
 
 
895
FILE_UPLOAD_HANDLERS
 
896
--------------------
 
897
 
 
898
Default::
 
899
 
 
900
    ("django.core.files.uploadhandler.MemoryFileUploadHandler",
 
901
     "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
 
902
 
 
903
A tuple of handlers to use for uploading. See :doc:`/topics/files` for details.
 
904
 
 
905
.. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
 
906
 
 
907
FILE_UPLOAD_MAX_MEMORY_SIZE
 
908
---------------------------
 
909
 
 
910
Default: ``2621440`` (i.e. 2.5 MB).
 
911
 
 
912
The maximum size (in bytes) that an upload will be before it gets streamed to
 
913
the file system. See :doc:`/topics/files` for details.
 
914
 
 
915
.. setting:: FILE_UPLOAD_PERMISSIONS
 
916
 
 
917
FILE_UPLOAD_PERMISSIONS
 
918
-----------------------
 
919
 
 
920
Default: ``None``
 
921
 
 
922
The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
 
923
more information about what these modes mean, see the `documentation for
 
924
os.chmod`_
 
925
 
 
926
If this isn't given or is ``None``, you'll get operating-system
 
927
dependent behavior. On most platforms, temporary files will have a mode
 
928
of ``0600``, and files saved from memory will be saved using the
 
929
system's standard umask.
 
930
 
 
931
.. warning::
 
932
 
 
933
    **Always prefix the mode with a 0.**
 
934
 
 
935
    If you're not familiar with file modes, please note that the leading
 
936
    ``0`` is very important: it indicates an octal number, which is the
 
937
    way that modes must be specified. If you try to use ``644``, you'll
 
938
    get totally incorrect behavior.
 
939
 
 
940
 
 
941
.. _documentation for os.chmod: http://docs.python.org/library/os.html#os.chmod
 
942
 
 
943
.. setting:: FILE_UPLOAD_TEMP_DIR
 
944
 
 
945
FILE_UPLOAD_TEMP_DIR
 
946
--------------------
 
947
 
 
948
Default: ``None``
 
949
 
 
950
The directory to store data temporarily while uploading files. If ``None``,
 
951
Django will use the standard temporary directory for the operating system. For
 
952
example, this will default to '/tmp' on \*nix-style operating systems.
 
953
 
 
954
See :doc:`/topics/files` for details.
 
955
 
 
956
.. setting:: FIRST_DAY_OF_WEEK
 
957
 
 
958
FIRST_DAY_OF_WEEK
 
959
-----------------
 
960
 
 
961
.. versionadded:: 1.2
 
962
 
 
963
Default: ``0`` (Sunday)
 
964
 
 
965
Number representing the first day of the week. This is especially useful
 
966
when displaying a calendar. This value is only used when not using
 
967
format internationalization, or when a format cannot be found for the
 
968
current locale.
 
969
 
 
970
The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
 
971
Monday and so on.
 
972
 
 
973
.. setting:: FIXTURE_DIRS
 
974
 
 
975
FIXTURE_DIRS
 
976
-------------
 
977
 
 
978
Default: ``()`` (Empty tuple)
 
979
 
 
980
List of locations of the fixture data files, in search order. Note that
 
981
these paths should use Unix-style forward slashes, even on Windows. See
 
982
:doc:`/topics/testing`.
 
983
 
 
984
FORCE_SCRIPT_NAME
 
985
------------------
 
986
 
 
987
Default: ``None``
 
988
 
 
989
If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
 
990
environment variable in any HTTP request. This setting can be used to override
 
991
the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
 
992
of the preferred value or not supplied at all.
 
993
 
 
994
.. setting:: FORMAT_MODULE_PATH
 
995
 
 
996
FORMAT_MODULE_PATH
 
997
------------------
 
998
 
 
999
.. versionadded:: 1.2
 
1000
 
 
1001
Default: ``None``
 
1002
 
 
1003
A full Python path to a Python package that contains format definitions for
 
1004
project locales. If not ``None``, Django will check for a ``formats.py``
 
1005
file, under the directory named as the current locale, and will use the
 
1006
formats defined on this file.
 
1007
 
 
1008
For example, if ``FORMAT_MODULE_PATH`` is set to ``mysite.formats``, and
 
1009
current language is ``en`` (English), Django will expect a directory tree
 
1010
like::
 
1011
 
 
1012
    mysite/
 
1013
        formats/
 
1014
            __init__.py
 
1015
            en/
 
1016
                __init__.py
 
1017
                formats.py
 
1018
 
 
1019
Available formats are ``DATE_FORMAT``, ``TIME_FORMAT``, ``DATETIME_FORMAT``,
 
1020
``YEAR_MONTH_FORMAT``, ``MONTH_DAY_FORMAT``, ``SHORT_DATE_FORMAT``,
 
1021
``SHORT_DATETIME_FORMAT``, ``FIRST_DAY_OF_WEEK``, ``DECIMAL_SEPARATOR``,
 
1022
``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
 
1023
 
 
1024
.. setting:: IGNORABLE_404_ENDS
 
1025
 
 
1026
IGNORABLE_404_ENDS
 
1027
------------------
 
1028
 
 
1029
Default: ``('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')``
 
1030
 
 
1031
See also ``IGNORABLE_404_STARTS`` and ``Error reporting via e-mail``.
 
1032
 
 
1033
.. setting:: IGNORABLE_404_STARTS
 
1034
 
 
1035
IGNORABLE_404_STARTS
 
1036
--------------------
 
1037
 
 
1038
Default: ``('/cgi-bin/', '/_vti_bin', '/_vti_inf')``
 
1039
 
 
1040
A tuple of strings that specify beginnings of URLs that should be ignored by
 
1041
the 404 e-mailer. See ``SEND_BROKEN_LINK_EMAILS``, ``IGNORABLE_404_ENDS`` and
 
1042
the :doc:`/howto/error-reporting`.
 
1043
 
 
1044
.. setting:: INSTALLED_APPS
 
1045
 
 
1046
INSTALLED_APPS
 
1047
--------------
 
1048
 
 
1049
Default: ``()`` (Empty tuple)
 
1050
 
 
1051
A tuple of strings designating all applications that are enabled in this Django
 
1052
installation. Each string should be a full Python path to a Python package that
 
1053
contains a Django application, as created by :djadmin:`django-admin.py startapp
 
1054
<startapp>`.
 
1055
 
 
1056
.. admonition:: App names must be unique
 
1057
 
 
1058
    The application names (that is, the final dotted part of the
 
1059
    path to the module containing ``models.py``) defined in
 
1060
    :setting:`INSTALLED_APPS` *must* be unique. For example, you can't
 
1061
    include both ``django.contrib.auth`` and ``myproject.auth`` in
 
1062
    INSTALLED_APPS.
 
1063
 
 
1064
.. setting:: INTERNAL_IPS
 
1065
 
 
1066
INTERNAL_IPS
 
1067
------------
 
1068
 
 
1069
Default: ``()`` (Empty tuple)
 
1070
 
 
1071
A tuple of IP addresses, as strings, that:
 
1072
 
 
1073
    * See debug comments, when ``DEBUG`` is ``True``
 
1074
    * Receive X headers if the ``XViewMiddleware`` is installed (see
 
1075
      :doc:`/topics/http/middleware`)
 
1076
 
 
1077
.. setting:: LANGUAGE_CODE
 
1078
 
 
1079
LANGUAGE_CODE
 
1080
-------------
 
1081
 
 
1082
Default: ``'en-us'``
 
1083
 
 
1084
A string representing the language code for this installation. This should be in
 
1085
standard :term:`language format<language code>`. For example, U.S. English is
 
1086
``"en-us"``. See :doc:`/topics/i18n/index`.
 
1087
 
 
1088
.. setting:: LANGUAGE_COOKIE_NAME
 
1089
 
 
1090
LANGUAGE_COOKIE_NAME
 
1091
--------------------
 
1092
 
 
1093
Default: ``'django_language'``
 
1094
 
 
1095
The name of the cookie to use for the language cookie. This can be whatever you
 
1096
want (but should be different from ``SESSION_COOKIE_NAME``). See
 
1097
:doc:`/topics/i18n/index`.
 
1098
 
 
1099
.. setting:: LANGUAGES
 
1100
 
 
1101
LANGUAGES
 
1102
---------
 
1103
 
 
1104
Default: A tuple of all available languages. This list is continually growing
 
1105
and including a copy here would inevitably become rapidly out of date. You can
 
1106
see the current list of translated languages by looking in
 
1107
``django/conf/global_settings.py`` (or view the `online source`_).
 
1108
 
 
1109
.. _online source: http://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py
 
1110
 
 
1111
The list is a tuple of two-tuples in the format ``(language code, language
 
1112
name)``, the ``language code`` part should be a
 
1113
:term:`language name<language code>` -- for example, ``('ja', 'Japanese')``.
 
1114
This specifies which languages are available for language selection. See
 
1115
:doc:`/topics/i18n/index`.
 
1116
 
 
1117
Generally, the default value should suffice. Only set this setting if you want
 
1118
to restrict language selection to a subset of the Django-provided languages.
 
1119
 
 
1120
If you define a custom ``LANGUAGES`` setting, it's OK to mark the languages as
 
1121
translation strings (as in the default value referred to above) -- but use a
 
1122
"dummy" ``gettext()`` function, not the one in ``django.utils.translation``.
 
1123
You should *never* import ``django.utils.translation`` from within your
 
1124
settings file, because that module in itself depends on the settings, and that
 
1125
would cause a circular import.
 
1126
 
 
1127
The solution is to use a "dummy" ``gettext()`` function. Here's a sample
 
1128
settings file::
 
1129
 
 
1130
    gettext = lambda s: s
 
1131
 
 
1132
    LANGUAGES = (
 
1133
        ('de', gettext('German')),
 
1134
        ('en', gettext('English')),
 
1135
    )
 
1136
 
 
1137
With this arrangement, ``django-admin.py makemessages`` will still find and
 
1138
mark these strings for translation, but the translation won't happen at
 
1139
runtime -- so you'll have to remember to wrap the languages in the *real*
 
1140
``gettext()`` in any code that uses ``LANGUAGES`` at runtime.
 
1141
 
 
1142
.. setting:: LOCALE_PATHS
 
1143
 
 
1144
LOCALE_PATHS
 
1145
------------
 
1146
 
 
1147
Default: ``()`` (Empty tuple)
 
1148
 
 
1149
A tuple of directories where Django looks for translation files.
 
1150
See :ref:`using-translations-in-your-own-projects`.
 
1151
 
 
1152
Example::
 
1153
 
 
1154
    LOCALE_PATHS = (
 
1155
        '/home/www/project/common_files/locale',
 
1156
        '/var/local/translations/locale'
 
1157
    )
 
1158
 
 
1159
Note that in the paths you add to the value of this setting, if you have the
 
1160
typical ``/path/to/locale/xx/LC_MESSAGES`` hierarchy, you should use the path to
 
1161
the ``locale`` directory (i.e. ``'/path/to/locale'``).
 
1162
 
 
1163
.. setting:: LOGGING
 
1164
 
 
1165
LOGGING
 
1166
-------
 
1167
 
 
1168
.. versionadded:: 1.3
 
1169
 
 
1170
Default: A logging configuration dictionary.
 
1171
 
 
1172
A data structure containing configuration information. The contents of
 
1173
this data structure will be passed as the argument to the
 
1174
configuration method described in :setting:`LOGGING_CONFIG`.
 
1175
 
 
1176
The default logging configuration passes HTTP 500 server errors to an
 
1177
email log handler; all other log messages are given to a NullHandler.
 
1178
 
 
1179
.. setting:: LOGGING_CONFIG
 
1180
 
 
1181
LOGGING_CONFIG
 
1182
--------------
 
1183
 
 
1184
.. versionadded:: 1.3
 
1185
 
 
1186
Default: ``'django.utils.log.dictConfig'``
 
1187
 
 
1188
A path to a callable that will be used to configure logging in the
 
1189
Django project. Points at a instance of Python's `dictConfig`_
 
1190
configuration method by default.
 
1191
 
 
1192
If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
 
1193
configuration process will be skipped.
 
1194
 
 
1195
.. _dictConfig: http://docs.python.org/library/logging.html#logging.dictConfig
 
1196
 
 
1197
.. setting:: LOGIN_REDIRECT_URL
 
1198
 
 
1199
LOGIN_REDIRECT_URL
 
1200
------------------
 
1201
 
 
1202
Default: ``'/accounts/profile/'``
 
1203
 
 
1204
The URL where requests are redirected after login when the
 
1205
``contrib.auth.login`` view gets no ``next`` parameter.
 
1206
 
 
1207
This is used by the :func:`~django.contrib.auth.decorators.login_required`
 
1208
decorator, for example.
 
1209
 
 
1210
.. setting:: LOGIN_URL
 
1211
 
 
1212
LOGIN_URL
 
1213
---------
 
1214
 
 
1215
Default: ``'/accounts/login/'``
 
1216
 
 
1217
The URL where requests are redirected for login, especially when using the
 
1218
:func:`~django.contrib.auth.decorators.login_required` decorator.
 
1219
 
 
1220
.. setting:: LOGOUT_URL
 
1221
 
 
1222
LOGOUT_URL
 
1223
----------
 
1224
 
 
1225
Default: ``'/accounts/logout/'``
 
1226
 
 
1227
LOGIN_URL counterpart.
 
1228
 
 
1229
.. setting:: MANAGERS
 
1230
 
 
1231
MANAGERS
 
1232
--------
 
1233
 
 
1234
Default: ``()`` (Empty tuple)
 
1235
 
 
1236
A tuple in the same format as ``ADMINS`` that specifies who should get
 
1237
broken-link notifications when ``SEND_BROKEN_LINK_EMAILS=True``.
 
1238
 
 
1239
.. setting:: MEDIA_ROOT
 
1240
 
 
1241
MEDIA_ROOT
 
1242
----------
 
1243
 
 
1244
Default: ``''`` (Empty string)
 
1245
 
 
1246
Absolute path to the directory that holds media for this installation, used
 
1247
for :doc:`managing stored files </topics/files>`.
 
1248
 
 
1249
Example: ``"/home/media/media.lawrence.com/"``
 
1250
 
 
1251
See also :setting:`MEDIA_URL`.
 
1252
 
 
1253
.. setting:: MEDIA_URL
 
1254
 
 
1255
MEDIA_URL
 
1256
---------
 
1257
 
 
1258
Default: ``''`` (Empty string)
 
1259
 
 
1260
URL that handles the media served from :setting:`MEDIA_ROOT`, used
 
1261
for :doc:`managing stored files </topics/files>`.
 
1262
 
 
1263
Example: ``"http://media.lawrence.com/"``
 
1264
 
 
1265
.. versionchanged:: 1.3
 
1266
   It must end in a slash if set to a non-empty value.
 
1267
 
 
1268
MESSAGE_LEVEL
 
1269
-------------
 
1270
 
 
1271
.. versionadded:: 1.2
 
1272
 
 
1273
Default: `messages.INFO`
 
1274
 
 
1275
Sets the minimum message level that will be recorded by the messages
 
1276
framework. See the :doc:`messages documentation </ref/contrib/messages>` for
 
1277
more details.
 
1278
 
 
1279
MESSAGE_STORAGE
 
1280
---------------
 
1281
 
 
1282
.. versionadded:: 1.2
 
1283
 
 
1284
Default: ``'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'``
 
1285
 
 
1286
Controls where Django stores message data.  See the
 
1287
:doc:`messages documentation </ref/contrib/messages>` for more details.
 
1288
 
 
1289
MESSAGE_TAGS
 
1290
------------
 
1291
 
 
1292
.. versionadded:: 1.2
 
1293
 
 
1294
Default::
 
1295
 
 
1296
        {messages.DEBUG: 'debug',
 
1297
        messages.INFO: 'info',
 
1298
        messages.SUCCESS: 'success',
 
1299
        messages.WARNING: 'warning',
 
1300
        messages.ERROR: 'error',}
 
1301
 
 
1302
Sets the mapping of message levels to message tags. See the
 
1303
:doc:`messages documentation </ref/contrib/messages>` for more details.
 
1304
 
 
1305
.. setting:: MIDDLEWARE_CLASSES
 
1306
 
 
1307
MIDDLEWARE_CLASSES
 
1308
------------------
 
1309
 
 
1310
Default::
 
1311
 
 
1312
    ('django.middleware.common.CommonMiddleware',
 
1313
     'django.contrib.sessions.middleware.SessionMiddleware',
 
1314
     'django.middleware.csrf.CsrfViewMiddleware',
 
1315
     'django.contrib.auth.middleware.AuthenticationMiddleware',
 
1316
     'django.contrib.messages.middleware.MessageMiddleware',)
 
1317
 
 
1318
A tuple of middleware classes to use. See :doc:`/topics/http/middleware`.
 
1319
 
 
1320
.. versionchanged:: 1.2
 
1321
   ``'django.contrib.messages.middleware.MessageMiddleware'`` was added to the
 
1322
   default.  For more information, see the :doc:`messages documentation
 
1323
   </ref/contrib/messages>`.
 
1324
 
 
1325
.. setting:: MONTH_DAY_FORMAT
 
1326
 
 
1327
MONTH_DAY_FORMAT
 
1328
----------------
 
1329
 
 
1330
Default: ``'F j'``
 
1331
 
 
1332
The default formatting to use for date fields on Django admin change-list
 
1333
pages -- and, possibly, by other parts of the system -- in cases when only the
 
1334
month and day are displayed.
 
1335
 
 
1336
For example, when a Django admin change-list page is being filtered by a date
 
1337
drilldown, the header for a given day displays the day and month. Different
 
1338
locales have different formats. For example, U.S. English would say
 
1339
"January 1," whereas Spanish might say "1 Enero."
 
1340
 
 
1341
See :tfilter:`allowed date format strings <date>`. See also ``DATE_FORMAT``,
 
1342
``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
 
1343
 
 
1344
.. setting:: NUMBER_GROUPING
 
1345
 
 
1346
NUMBER_GROUPING
 
1347
----------------
 
1348
 
 
1349
.. versionadded:: 1.2
 
1350
 
 
1351
Default: ``0``
 
1352
 
 
1353
Number of digits grouped together on the integer part of a number. Common use
 
1354
is to display a thousand separator. If this setting is ``0``, then, no grouping
 
1355
will be applied to the number. If this setting is greater than ``0`` then the
 
1356
setting :setting:`THOUSAND_SEPARATOR` will be used as the separator between those
 
1357
groups.
 
1358
 
 
1359
See also :setting:`THOUSAND_SEPARATOR` and :setting:`USE_THOUSAND_SEPARATOR`.
 
1360
 
 
1361
.. setting:: PASSWORD_RESET_TIMEOUT_DAYS
 
1362
 
 
1363
PASSWORD_RESET_TIMEOUT_DAYS
 
1364
---------------------------
 
1365
 
 
1366
Default: ``3``
 
1367
 
 
1368
The number of days a password reset link is valid for. Used by the
 
1369
:mod:`django.contrib.auth` password reset mechanism.
 
1370
 
 
1371
.. setting:: PREPEND_WWW
 
1372
 
 
1373
PREPEND_WWW
 
1374
-----------
 
1375
 
 
1376
Default: ``False``
 
1377
 
 
1378
Whether to prepend the "www." subdomain to URLs that don't have it. This is only
 
1379
used if :class:`~django.middleware.common.CommonMiddleware` is installed
 
1380
(see :doc:`/topics/http/middleware`). See also :setting:`APPEND_SLASH`.
 
1381
 
 
1382
.. setting:: PROFANITIES_LIST
 
1383
 
 
1384
PROFANITIES_LIST
 
1385
----------------
 
1386
 
 
1387
Default: ``()`` (Empty tuple)
 
1388
 
 
1389
A tuple of profanities, as strings, that will trigger a validation error when
 
1390
the ``hasNoProfanities`` validator is called.
 
1391
 
 
1392
.. setting:: RESTRUCTUREDTEXT_FILTER_SETTINGS
 
1393
 
 
1394
RESTRUCTUREDTEXT_FILTER_SETTINGS
 
1395
--------------------------------
 
1396
 
 
1397
Default: ``{}``
 
1398
 
 
1399
A dictionary containing settings for the ``restructuredtext`` markup filter from
 
1400
the :doc:`django.contrib.markup application </ref/contrib/markup>`. They override
 
1401
the default writer settings. See the Docutils restructuredtext `writer settings
 
1402
docs`_ for details.
 
1403
 
 
1404
.. _writer settings docs: http://docutils.sourceforge.net/docs/user/config.html#html4css1-writer
 
1405
 
 
1406
.. setting:: ROOT_URLCONF
 
1407
 
 
1408
ROOT_URLCONF
 
1409
------------
 
1410
 
 
1411
Default: Not defined
 
1412
 
 
1413
A string representing the full Python import path to your root URLconf. For example:
 
1414
``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
 
1415
setting the attribute ``urlconf`` on the incoming ``HttpRequest``
 
1416
object. See :ref:`how-django-processes-a-request` for details.
 
1417
 
 
1418
.. setting:: SECRET_KEY
 
1419
 
 
1420
SECRET_KEY
 
1421
----------
 
1422
 
 
1423
Default: ``''`` (Empty string)
 
1424
 
 
1425
A secret key for this particular Django installation. Used to provide a seed in
 
1426
secret-key hashing algorithms. Set this to a random string -- the longer, the
 
1427
better. ``django-admin.py startproject`` creates one automatically.
 
1428
 
 
1429
.. setting:: SEND_BROKEN_LINK_EMAILS
 
1430
 
 
1431
SEND_BROKEN_LINK_EMAILS
 
1432
-----------------------
 
1433
 
 
1434
Default: ``False``
 
1435
 
 
1436
Whether to send an e-mail to the ``MANAGERS`` each time somebody visits a
 
1437
Django-powered page that is 404ed with a non-empty referer (i.e., a broken
 
1438
link). This is only used if ``CommonMiddleware`` is installed (see
 
1439
:doc:`/topics/http/middleware`. See also ``IGNORABLE_404_STARTS``,
 
1440
``IGNORABLE_404_ENDS`` and :doc:`/howto/error-reporting`.
 
1441
 
 
1442
.. setting:: SERIALIZATION_MODULES
 
1443
 
 
1444
SERIALIZATION_MODULES
 
1445
---------------------
 
1446
 
 
1447
Default: Not defined.
 
1448
 
 
1449
A dictionary of modules containing serializer definitions (provided as
 
1450
strings), keyed by a string identifier for that serialization type. For
 
1451
example, to define a YAML serializer, use::
 
1452
 
 
1453
    SERIALIZATION_MODULES = { 'yaml' : 'path.to.yaml_serializer' }
 
1454
 
 
1455
.. setting:: SERVER_EMAIL
 
1456
 
 
1457
SERVER_EMAIL
 
1458
------------
 
1459
 
 
1460
Default: ``'root@localhost'``
 
1461
 
 
1462
The e-mail address that error messages come from, such as those sent to
 
1463
``ADMINS`` and ``MANAGERS``.
 
1464
 
 
1465
.. setting:: SESSION_COOKIE_AGE
 
1466
 
 
1467
SESSION_COOKIE_AGE
 
1468
------------------
 
1469
 
 
1470
Default: ``1209600`` (2 weeks, in seconds)
 
1471
 
 
1472
The age of session cookies, in seconds. See :doc:`/topics/http/sessions`.
 
1473
 
 
1474
.. setting:: SESSION_COOKIE_DOMAIN
 
1475
 
 
1476
SESSION_COOKIE_DOMAIN
 
1477
---------------------
 
1478
 
 
1479
Default: ``None``
 
1480
 
 
1481
The domain to use for session cookies. Set this to a string such as
 
1482
``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard
 
1483
domain cookie. See the :doc:`/topics/http/sessions`.
 
1484
 
 
1485
.. setting:: SESSION_COOKIE_HTTPONLY
 
1486
 
 
1487
SESSION_COOKIE_HTTPONLY
 
1488
-----------------------
 
1489
 
 
1490
Default: ``False``
 
1491
 
 
1492
Whether to use HTTPOnly flag on the session cookie. If this is set to
 
1493
``True``, client-side JavaScript will not to be able to access the
 
1494
session cookie.
 
1495
 
 
1496
HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It
 
1497
is not part of the RFC2109 standard for cookies, and it isn't honored
 
1498
consistently by all browsers. However, when it is honored, it can be a
 
1499
useful way to mitigate the risk of client side script accessing the
 
1500
protected cookie data.
 
1501
 
 
1502
.. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly
 
1503
 
 
1504
.. setting:: SESSION_COOKIE_NAME
 
1505
 
 
1506
SESSION_COOKIE_NAME
 
1507
-------------------
 
1508
 
 
1509
Default: ``'sessionid'``
 
1510
 
 
1511
The name of the cookie to use for sessions. This can be whatever you want (but
 
1512
should be different from ``LANGUAGE_COOKIE_NAME``). See the :doc:`/topics/http/sessions`.
 
1513
 
 
1514
.. setting:: SESSION_COOKIE_PATH
 
1515
 
 
1516
SESSION_COOKIE_PATH
 
1517
-------------------
 
1518
 
 
1519
Default: ``'/'``
 
1520
 
 
1521
The path set on the session cookie. This should either match the URL path of your
 
1522
Django installation or be parent of that path.
 
1523
 
 
1524
This is useful if you have multiple Django instances running under the same
 
1525
hostname. They can use different cookie paths, and each instance will only see
 
1526
its own session cookie.
 
1527
 
 
1528
.. setting:: SESSION_COOKIE_SECURE
 
1529
 
 
1530
SESSION_COOKIE_SECURE
 
1531
---------------------
 
1532
 
 
1533
Default: ``False``
 
1534
 
 
1535
Whether to use a secure cookie for the session cookie. If this is set to
 
1536
``True``, the cookie will be marked as "secure," which means browsers may
 
1537
ensure that the cookie is only sent under an HTTPS connection.
 
1538
See the :doc:`/topics/http/sessions`.
 
1539
 
 
1540
.. setting:: SESSION_ENGINE
 
1541
 
 
1542
SESSION_ENGINE
 
1543
--------------
 
1544
 
 
1545
Default: ``django.contrib.sessions.backends.db``
 
1546
 
 
1547
Controls where Django stores session data. Valid values are:
 
1548
 
 
1549
    * ``'django.contrib.sessions.backends.db'``
 
1550
    * ``'django.contrib.sessions.backends.file'``
 
1551
    * ``'django.contrib.sessions.backends.cache'``
 
1552
    * ``'django.contrib.sessions.backends.cached_db'``
 
1553
 
 
1554
See :doc:`/topics/http/sessions`.
 
1555
 
 
1556
.. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
 
1557
 
 
1558
SESSION_EXPIRE_AT_BROWSER_CLOSE
 
1559
-------------------------------
 
1560
 
 
1561
Default: ``False``
 
1562
 
 
1563
Whether to expire the session when the user closes his or her browser.
 
1564
See the :doc:`/topics/http/sessions`.
 
1565
 
 
1566
.. setting:: SESSION_FILE_PATH
 
1567
 
 
1568
SESSION_FILE_PATH
 
1569
-----------------
 
1570
 
 
1571
Default: ``None``
 
1572
 
 
1573
If you're using file-based session storage, this sets the directory in
 
1574
which Django will store session data. See :doc:`/topics/http/sessions`. When
 
1575
the default value (``None``) is used, Django will use the standard temporary
 
1576
directory for the system.
 
1577
 
 
1578
.. setting:: SESSION_SAVE_EVERY_REQUEST
 
1579
 
 
1580
SESSION_SAVE_EVERY_REQUEST
 
1581
--------------------------
 
1582
 
 
1583
Default: ``False``
 
1584
 
 
1585
Whether to save the session data on every request. See
 
1586
:doc:`/topics/http/sessions`.
 
1587
 
 
1588
.. setting:: SHORT_DATE_FORMAT
 
1589
 
 
1590
SHORT_DATE_FORMAT
 
1591
-----------------
 
1592
 
 
1593
.. versionadded:: 1.2
 
1594
 
 
1595
Default: ``m/d/Y`` (e.g. ``12/31/2003``)
 
1596
 
 
1597
An available formatting that can be used for displaying date fields on
 
1598
templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
 
1599
corresponding locale-dictated format has higher precedence and will be applied.
 
1600
See :tfilter:`allowed date format strings <date>`.
 
1601
 
 
1602
See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
 
1603
 
 
1604
.. setting:: SHORT_DATETIME_FORMAT
 
1605
 
 
1606
SHORT_DATETIME_FORMAT
 
1607
---------------------
 
1608
 
 
1609
.. versionadded:: 1.2
 
1610
 
 
1611
Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
 
1612
 
 
1613
An available formatting that can be used for displaying datetime fields on
 
1614
templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
 
1615
corresponding locale-dictated format has higher precedence and will be applied.
 
1616
See :tfilter:`allowed date format strings <date>`.
 
1617
 
 
1618
See also ``DATE_FORMAT`` and ``SHORT_DATETIME_FORMAT``.
 
1619
 
 
1620
.. setting:: SITE_ID
 
1621
 
 
1622
SITE_ID
 
1623
-------
 
1624
 
 
1625
Default: Not defined
 
1626
 
 
1627
The ID, as an integer, of the current site in the ``django_site`` database
 
1628
table. This is used so that application data can hook into specific site(s)
 
1629
and a single database can manage content for multiple sites.
 
1630
 
 
1631
See :doc:`/ref/contrib/sites`.
 
1632
 
 
1633
.. _site framework docs: ../sites/
 
1634
 
 
1635
.. setting:: STATIC_ROOT
 
1636
 
 
1637
STATIC_ROOT
 
1638
-----------
 
1639
 
 
1640
Default: ``''`` (Empty string)
 
1641
 
 
1642
The absolute path to the directory where :djadmin:`collectstatic` will collect
 
1643
static files for deployment.
 
1644
 
 
1645
Example: ``"/home/example.com/static/"``
 
1646
 
 
1647
If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
 
1648
(default) the :djadmin:`collectstatic` management command will collect static
 
1649
files into this directory. See the howto on :doc:`managing static
 
1650
files</howto/static-files>` for more details about usage.
 
1651
 
 
1652
.. warning:: This should be an (initially empty) destination directory for
 
1653
    collecting your static files from their permanent locations into one
 
1654
    directory for ease of deployment; it is **not** a place to store your
 
1655
    static files permanently. You should do that in directories that will be
 
1656
    found by :doc:`staticfiles</ref/contrib/staticfiles>`'s
 
1657
    :setting:`finders<STATICFILES_FINDERS>`, which by default, are
 
1658
    ``'static/'`` app sub-directories and any directories you include in
 
1659
    :setting:`STATICFILES_DIRS`).
 
1660
 
 
1661
See :doc:`staticfiles reference</ref/contrib/staticfiles>` and
 
1662
:setting:`STATIC_URL`.
 
1663
 
 
1664
.. setting:: STATIC_URL
 
1665
 
 
1666
STATIC_URL
 
1667
----------
 
1668
 
 
1669
Default: ``None``
 
1670
 
 
1671
URL to use when referring to static files located in :setting:`STATIC_ROOT`.
 
1672
 
 
1673
Example: ``"/site_media/static/"`` or ``"http://static.example.com/"``
 
1674
 
 
1675
If not ``None``, this will be used as the base path for
 
1676
:ref:`media definitions<form-media-paths>` and the
 
1677
:doc:`staticfiles app</ref/contrib/staticfiles>`.
 
1678
 
 
1679
It must end in a slash if set to a non-empty value.
 
1680
 
 
1681
See :setting:`STATIC_ROOT`.
 
1682
 
 
1683
.. setting:: TEMPLATE_CONTEXT_PROCESSORS
 
1684
 
 
1685
TEMPLATE_CONTEXT_PROCESSORS
 
1686
---------------------------
 
1687
 
 
1688
Default::
 
1689
 
 
1690
    ("django.contrib.auth.context_processors.auth",
 
1691
    "django.core.context_processors.debug",
 
1692
    "django.core.context_processors.i18n",
 
1693
    "django.core.context_processors.media",
 
1694
    "django.core.context_processors.static",
 
1695
    "django.contrib.messages.context_processors.messages")
 
1696
 
 
1697
A tuple of callables that are used to populate the context in ``RequestContext``.
 
1698
These callables take a request object as their argument and return a dictionary
 
1699
of items to be merged into the context.
 
1700
 
 
1701
.. versionchanged:: 1.2
 
1702
   ``django.contrib.messages.context_processors.messages`` was added to the
 
1703
   default.  For more information, see the :doc:`messages documentation
 
1704
   </ref/contrib/messages>`.
 
1705
 
 
1706
.. versionchanged:: 1.2
 
1707
    The auth context processor was moved in this release from its old location
 
1708
    ``django.core.context_processors.auth`` to
 
1709
    ``django.contrib.auth.context_processors.auth``.
 
1710
 
 
1711
.. versionadded:: 1.3
 
1712
    The ``django.core.context_processors.static`` context processor
 
1713
    was added in this release.
 
1714
 
 
1715
.. setting:: TEMPLATE_DEBUG
 
1716
 
 
1717
TEMPLATE_DEBUG
 
1718
--------------
 
1719
 
 
1720
Default: ``False``
 
1721
 
 
1722
A boolean that turns on/off template debug mode. If this is ``True``, the fancy
 
1723
error page will display a detailed report for any ``TemplateSyntaxError``. This
 
1724
report contains the relevant snippet of the template, with the appropriate line
 
1725
highlighted.
 
1726
 
 
1727
Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so
 
1728
you'll want to set that to take advantage of this setting.
 
1729
 
 
1730
See also ``DEBUG``.
 
1731
 
 
1732
.. setting:: TEMPLATE_DIRS
 
1733
 
 
1734
TEMPLATE_DIRS
 
1735
-------------
 
1736
 
 
1737
Default: ``()`` (Empty tuple)
 
1738
 
 
1739
List of locations of the template source files, in search order. Note that
 
1740
these paths should use Unix-style forward slashes, even on Windows.
 
1741
 
 
1742
See :doc:`/topics/templates`.
 
1743
 
 
1744
.. setting:: TEMPLATE_LOADERS
 
1745
 
 
1746
TEMPLATE_LOADERS
 
1747
----------------
 
1748
 
 
1749
Default::
 
1750
 
 
1751
     ('django.template.loaders.filesystem.Loader',
 
1752
      'django.template.loaders.app_directories.Loader')
 
1753
 
 
1754
A tuple of template loader classes, specified as strings. Each ``Loader`` class
 
1755
knows how to import templates from a particular source. Optionally, a tuple can be
 
1756
used instead of a string. The first item in the tuple should be the ``Loader``'s
 
1757
module, subsequent items are passed to the ``Loader`` during initialization. See
 
1758
:doc:`/ref/templates/api`.
 
1759
 
 
1760
.. versionchanged:: 1.2
 
1761
    The class-based API for template loaders was introduced in Django 1.2
 
1762
    although  the ``TEMPLATE_LOADERS`` setting will accept strings that specify
 
1763
    function-based loaders until compatibility with them is completely removed in
 
1764
    Django 1.4.
 
1765
 
 
1766
.. setting:: TEMPLATE_STRING_IF_INVALID
 
1767
 
 
1768
TEMPLATE_STRING_IF_INVALID
 
1769
--------------------------
 
1770
 
 
1771
Default: ``''`` (Empty string)
 
1772
 
 
1773
Output, as a string, that the template system should use for invalid (e.g.
 
1774
misspelled) variables. See :ref:`invalid-template-variables`..
 
1775
 
 
1776
.. setting:: TEST_RUNNER
 
1777
 
 
1778
TEST_RUNNER
 
1779
-----------
 
1780
 
 
1781
Default: ``'django.test.simple.DjangoTestSuiteRunner'``
 
1782
 
 
1783
.. versionchanged:: 1.2
 
1784
   Prior to 1.2, test runners were a function, not a class.
 
1785
 
 
1786
The name of the class to use for starting the test suite. See
 
1787
:doc:`/topics/testing`.
 
1788
 
 
1789
.. _Testing Django Applications: ../testing/
 
1790
 
 
1791
.. setting:: THOUSAND_SEPARATOR
 
1792
 
 
1793
THOUSAND_SEPARATOR
 
1794
------------------
 
1795
 
 
1796
.. versionadded:: 1.2
 
1797
 
 
1798
Default ``,`` (Comma)
 
1799
 
 
1800
Default thousand separator used when formatting numbers. This setting is
 
1801
used only when ``NUMBER_GROUPING`` and ``USE_THOUSAND_SEPARATOR`` are set.
 
1802
 
 
1803
See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and
 
1804
:setting:`USE_THOUSAND_SEPARATOR`.
 
1805
 
 
1806
.. setting:: TIME_FORMAT
 
1807
 
 
1808
TIME_FORMAT
 
1809
-----------
 
1810
 
 
1811
Default: ``'P'`` (e.g. ``4 p.m.``)
 
1812
 
 
1813
The default formatting to use for displaying time fields in any part of the
 
1814
system. Note that if :setting:`USE_L10N` is set to ``True``, then the
 
1815
locale-dictated format has higher precedence and will be applied instead. See
 
1816
:tfilter:`allowed date format strings <date>`.
 
1817
 
 
1818
.. versionchanged:: 1.2
 
1819
    This setting can now be overriden by setting ``USE_L10N`` to ``True``.
 
1820
 
 
1821
See also ``DATE_FORMAT`` and ``DATETIME_FORMAT``.
 
1822
 
 
1823
.. setting:: TIME_INPUT_FORMATS
 
1824
 
 
1825
TIME_INPUT_FORMATS
 
1826
------------------
 
1827
 
 
1828
.. versionadded:: 1.2
 
1829
 
 
1830
Default: ``('%H:%M:%S', '%H:%M')``
 
1831
 
 
1832
A tuple of formats that will be accepted when inputting data on a time
 
1833
field. Formats will be tried in order, using the first valid.
 
1834
Note that these format strings are specified in Python's datetime_ module
 
1835
syntax, that is different from the one used by Django for formatting dates
 
1836
to be displayed.
 
1837
 
 
1838
See also ``DATE_INPUT_FORMATS`` and ``DATETIME_INPUT_FORMATS``.
 
1839
 
 
1840
.. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
 
1841
 
 
1842
.. setting:: TIME_ZONE
 
1843
 
 
1844
TIME_ZONE
 
1845
---------
 
1846
 
 
1847
Default: ``'America/Chicago'``
 
1848
 
 
1849
.. versionchanged:: 1.2
 
1850
   ``None`` was added as an allowed value.
 
1851
 
 
1852
A string representing the time zone for this installation, or
 
1853
``None``. `See available choices`_. (Note that list of available
 
1854
choices lists more than one on the same line; you'll want to use just
 
1855
one of the choices for a given time zone. For instance, one line says
 
1856
``'Europe/London GB GB-Eire'``, but you should use the first bit of
 
1857
that -- ``'Europe/London'`` -- as your ``TIME_ZONE`` setting.)
 
1858
 
 
1859
Note that this is the time zone to which Django will convert all
 
1860
dates/times -- not necessarily the timezone of the server. For
 
1861
example, one server may serve multiple Django-powered sites, each with
 
1862
a separate time-zone setting.
 
1863
 
 
1864
Normally, Django sets the ``os.environ['TZ']`` variable to the time
 
1865
zone you specify in the ``TIME_ZONE`` setting. Thus, all your views
 
1866
and models will automatically operate in the correct time zone.
 
1867
However, Django won't set the ``TZ`` environment variable under the
 
1868
following conditions:
 
1869
 
 
1870
 * If you're using the manual configuration option as described in
 
1871
   :ref:`manually configuring settings
 
1872
   <settings-without-django-settings-module>`, or
 
1873
 
 
1874
 * If you specify ``TIME_ZONE = None``. This will cause Django to fall
 
1875
   back to using the system timezone.
 
1876
 
 
1877
If Django doesn't set the ``TZ`` environment variable, it's up to you
 
1878
to ensure your processes are running in the correct environment.
 
1879
 
 
1880
.. note::
 
1881
    Django cannot reliably use alternate time zones in a Windows
 
1882
    environment. If you're running Django on Windows, this variable
 
1883
    must be set to match the system timezone.
 
1884
 
 
1885
 
 
1886
.. _See available choices: http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
 
1887
 
 
1888
.. setting:: USE_ETAGS
 
1889
 
 
1890
USE_ETAGS
 
1891
---------
 
1892
 
 
1893
Default: ``False``
 
1894
 
 
1895
A boolean that specifies whether to output the "Etag" header. This saves
 
1896
bandwidth but slows down performance. This is used by the ``CommonMiddleware``
 
1897
(see :doc:`/topics/http/middleware`) and in the``Cache Framework``
 
1898
(see :doc:`/topics/cache`).
 
1899
 
 
1900
.. setting:: USE_I18N
 
1901
 
 
1902
USE_I18N
 
1903
--------
 
1904
 
 
1905
Default: ``True``
 
1906
 
 
1907
A boolean that specifies whether Django's internationalization system should be
 
1908
enabled. This provides an easy way to turn it off, for performance. If this is
 
1909
set to ``False``, Django will make some optimizations so as not to load the
 
1910
internationalization machinery.
 
1911
 
 
1912
See also ``USE_L10N``
 
1913
 
 
1914
.. setting:: USE_L10N
 
1915
 
 
1916
USE_L10N
 
1917
--------
 
1918
 
 
1919
.. versionadded:: 1.2
 
1920
 
 
1921
Default ``False``
 
1922
 
 
1923
A boolean that specifies if data will be localized by default or not. If this
 
1924
is set to ``True``, e.g. Django will display numbers and dates using the
 
1925
format of the current locale.
 
1926
 
 
1927
See also ``USE_I18N`` and ``LANGUAGE_CODE``
 
1928
 
 
1929
.. setting:: USE_THOUSAND_SEPARATOR
 
1930
 
 
1931
USE_THOUSAND_SEPARATOR
 
1932
----------------------
 
1933
 
 
1934
.. versionadded:: 1.2
 
1935
 
 
1936
Default ``False``
 
1937
 
 
1938
A boolean that specifies wheter to display numbers using a thousand separator.
 
1939
If this is set to ``True``, Django will use values from ``THOUSAND_SEPARATOR``
 
1940
and ``NUMBER_GROUPING`` from current locale, to format the number.
 
1941
``USE_L10N`` must be set to ``True``, in order to format numbers.
 
1942
 
 
1943
See also ``THOUSAND_SEPARATOR`` and ``NUMBER_GROUPING``.
 
1944
 
 
1945
.. setting:: USE_X_FORWARDED_HOST
 
1946
 
 
1947
USE_X_FORWARDED_HOST
 
1948
--------------------
 
1949
 
 
1950
.. versionadded:: 1.3.1
 
1951
 
 
1952
Default: ``False``
 
1953
 
 
1954
A boolean that specifies whether to use the X-Forwarded-Host header in
 
1955
preference to the Host header. This should only be enabled if a proxy
 
1956
which sets this header is in use.
 
1957
 
 
1958
.. setting:: YEAR_MONTH_FORMAT
 
1959
 
 
1960
YEAR_MONTH_FORMAT
 
1961
-----------------
 
1962
 
 
1963
Default: ``'F Y'``
 
1964
 
 
1965
The default formatting to use for date fields on Django admin change-list
 
1966
pages -- and, possibly, by other parts of the system -- in cases when only the
 
1967
year and month are displayed.
 
1968
 
 
1969
For example, when a Django admin change-list page is being filtered by a date
 
1970
drilldown, the header for a given month displays the month and the year.
 
1971
Different locales have different formats. For example, U.S. English would say
 
1972
"January 2006," whereas another locale might say "2006/January."
 
1973
 
 
1974
See :tfilter:`allowed date format strings <date>`. See also ``DATE_FORMAT``,
 
1975
``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``MONTH_DAY_FORMAT``.
 
1976
 
 
1977
Deprecated settings
 
1978
===================
 
1979
 
 
1980
.. setting:: CACHE_BACKEND
 
1981
 
 
1982
CACHE_BACKEND
 
1983
-------------
 
1984
 
 
1985
.. deprecated:: 1.3
 
1986
   This setting has been replaced by :setting:`BACKEND <CACHES-BACKEND>` in
 
1987
   :setting:`CACHES`.
 
1988
 
 
1989
.. setting:: DATABASE_ENGINE
 
1990
 
 
1991
DATABASE_ENGINE
 
1992
---------------
 
1993
 
 
1994
.. deprecated:: 1.2
 
1995
   This setting has been replaced by :setting:`ENGINE` in
 
1996
   :setting:`DATABASES`.
 
1997
 
 
1998
.. setting:: DATABASE_HOST
 
1999
 
 
2000
DATABASE_HOST
 
2001
-------------
 
2002
 
 
2003
.. deprecated:: 1.2
 
2004
   This setting has been replaced by :setting:`HOST` in
 
2005
   :setting:`DATABASES`.
 
2006
 
 
2007
.. setting:: DATABASE_NAME
 
2008
 
 
2009
DATABASE_NAME
 
2010
-------------
 
2011
 
 
2012
.. deprecated:: 1.2
 
2013
   This setting has been replaced by :setting:`NAME` in
 
2014
   :setting:`DATABASES`.
 
2015
 
 
2016
.. setting:: DATABASE_OPTIONS
 
2017
 
 
2018
DATABASE_OPTIONS
 
2019
----------------
 
2020
 
 
2021
.. deprecated:: 1.2
 
2022
   This setting has been replaced by :setting:`OPTIONS` in
 
2023
   :setting:`DATABASES`.
 
2024
 
 
2025
.. setting:: DATABASE_PASSWORD
 
2026
 
 
2027
DATABASE_PASSWORD
 
2028
-----------------
 
2029
 
 
2030
.. deprecated:: 1.2
 
2031
   This setting has been replaced by :setting:`PASSWORD` in
 
2032
   :setting:`DATABASES`.
 
2033
 
 
2034
.. setting:: DATABASE_PORT
 
2035
 
 
2036
DATABASE_PORT
 
2037
-------------
 
2038
 
 
2039
.. deprecated:: 1.2
 
2040
   This setting has been replaced by :setting:`PORT` in
 
2041
   :setting:`DATABASES`.
 
2042
 
 
2043
.. setting:: DATABASE_USER
 
2044
 
 
2045
DATABASE_USER
 
2046
-------------
 
2047
 
 
2048
.. deprecated:: 1.2
 
2049
   This setting has been replaced by :setting:`USER` in
 
2050
   :setting:`DATABASES`.
 
2051
 
 
2052
.. setting:: TEST_DATABASE_CHARSET
 
2053
 
 
2054
TEST_DATABASE_CHARSET
 
2055
---------------------
 
2056
 
 
2057
.. deprecated:: 1.2
 
2058
   This setting has been replaced by :setting:`TEST_CHARSET` in
 
2059
   :setting:`DATABASES`.
 
2060
 
 
2061
.. setting:: TEST_DATABASE_COLLATION
 
2062
 
 
2063
TEST_DATABASE_COLLATION
 
2064
-----------------------
 
2065
 
 
2066
.. deprecated:: 1.2
 
2067
   This setting has been replaced by :setting:`TEST_COLLATION` in
 
2068
   :setting:`DATABASES`.
 
2069
 
 
2070
.. setting:: TEST_DATABASE_NAME
 
2071
 
 
2072
TEST_DATABASE_NAME
 
2073
------------------
 
2074
 
 
2075
.. deprecated:: 1.2
 
2076
   This setting has been replaced by :setting:`TEST_NAME` in
 
2077
   :setting:`DATABASES`.
 
2078
 
 
2079
 
 
2080
 
 
2081
URL_VALIDATOR_USER_AGENT
 
2082
------------------------
 
2083
 
 
2084
.. deprecated:: 1.3.1
 
2085
   This setting has been removed due to intractable performance and
 
2086
   security problems.
 
2087
 
 
2088
Default: ``Django/<version> (http://www.djangoproject.com/)``
 
2089
 
 
2090
The string to use as the ``User-Agent`` header when checking to see if
 
2091
URLs exist (see the ``verify_exists`` option on
 
2092
:class:`~django.db.models.URLField`). This setting was deprecated in
 
2093
1.3.1 along with ``verify_exists`` and will be removed in 1.4.
 
2094