settings.txt 32 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213
  1. .. _ref-settings:
  2. Available settings
  3. ==================
  4. Here's a full list of all available settings, in alphabetical order, and their
  5. default values.
  6. .. setting:: ABSOLUTE_URL_OVERRIDES
  7. ABSOLUTE_URL_OVERRIDES
  8. ----------------------
  9. Default: ``{}`` (Empty dictionary)
  10. A dictionary mapping ``"app_label.model_name"`` strings to functions that take
  11. a model object and return its URL. This is a way of overriding
  12. ``get_absolute_url()`` methods on a per-installation basis. Example::
  13. ABSOLUTE_URL_OVERRIDES = {
  14. 'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
  15. 'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
  16. }
  17. Note that the model name used in this setting should be all lower-case, regardless
  18. of the case of the actual model class name.
  19. .. setting:: ADMIN_FOR
  20. ADMIN_FOR
  21. ---------
  22. Default: ``()`` (Empty tuple)
  23. Used for admin-site settings modules, this should be a tuple of settings
  24. modules (in the format ``'foo.bar.baz'``) for which this site is an admin.
  25. The admin site uses this in its automatically-introspected documentation of
  26. models, views and template tags.
  27. .. setting:: ADMIN_MEDIA_PREFIX
  28. ADMIN_MEDIA_PREFIX
  29. ------------------
  30. Default: ``'/media/'``
  31. The URL prefix for admin media -- CSS, JavaScript and images used by
  32. the Django administrative interface. Make sure to use a trailing
  33. slash, and to have this be different from the ``MEDIA_URL`` setting
  34. (since the same URL cannot be mapped onto two different sets of
  35. files).
  36. .. setting:: ADMINS
  37. ADMINS
  38. ------
  39. Default: ``()`` (Empty tuple)
  40. A tuple that lists people who get code error notifications. When
  41. ``DEBUG=False`` and a view raises an exception, Django will e-mail these people
  42. with the full exception information. Each member of the tuple should be a tuple
  43. of (Full name, e-mail address). Example::
  44. (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
  45. Note that Django will e-mail *all* of these people whenever an error happens.
  46. See :ref:`howto-error-reporting` for more information.
  47. .. setting:: ALLOWED_INCLUDE_ROOTS
  48. ALLOWED_INCLUDE_ROOTS
  49. ---------------------
  50. Default: ``()`` (Empty tuple)
  51. A tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
  52. tag. This is a security measure, so that template authors can't access files
  53. that they shouldn't be accessing.
  54. For example, if ``ALLOWED_INCLUDE_ROOTS`` is ``('/home/html', '/var/www')``,
  55. then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
  56. wouldn't.
  57. .. setting:: APPEND_SLASH
  58. APPEND_SLASH
  59. ------------
  60. Default: ``True``
  61. Whether to append trailing slashes to URLs. This is only used if
  62. ``CommonMiddleware`` is installed (see :ref:`topics-http-middleware`). See also
  63. ``PREPEND_WWW``.
  64. .. setting:: AUTHENTICATION_BACKENDS
  65. AUTHENTICATION_BACKENDS
  66. -----------------------
  67. Default: ``('django.contrib.auth.backends.ModelBackend',)``
  68. A tuple of authentication backend classes (as strings) to use when attempting to
  69. authenticate a user. See the :ref:`authentication backends documentation
  70. <authentication-backends>` for details.
  71. .. setting:: AUTH_PROFILE_MODULE
  72. AUTH_PROFILE_MODULE
  73. -------------------
  74. Default: Not defined
  75. The site-specific user profile model used by this site. See
  76. :ref:`auth-profiles`.
  77. .. setting:: CACHE_BACKEND
  78. CACHE_BACKEND
  79. -------------
  80. Default: ``'locmem://'``
  81. The cache backend to use. See :ref:`topics-cache`.
  82. .. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
  83. CACHE_MIDDLEWARE_KEY_PREFIX
  84. ---------------------------
  85. Default: ``''`` (Empty string)
  86. The cache key prefix that the cache middleware should use. See
  87. :ref:`topics-cache`.
  88. .. setting:: CACHE_MIDDLEWARE_SECONDS
  89. CACHE_MIDDLEWARE_SECONDS
  90. ------------------------
  91. Default: ``600``
  92. The default number of seconds to cache a page when the caching middleware or
  93. ``cache_page()`` decorator is used.
  94. .. setting:: DATABASE_ENGINE
  95. DATABASE_ENGINE
  96. ---------------
  97. Default: ``''`` (Empty string)
  98. The database backend to use. The build-in database backends are
  99. ``'postgresql_psycopg2'``, ``'postgresql'``, ``'mysql'``, ``'sqlite3'``, and
  100. ``'oracle'``.
  101. In the Django development version, you can use a database backend that doesn't
  102. ship with Django by setting ``DATABASE_ENGINE`` to a fully-qualified path (i.e.
  103. ``mypackage.backends.whatever``). Writing a whole new database backend from
  104. scratch is left as an exercise to the reader; see the other backends for
  105. examples.
  106. .. setting:: DATABASE_HOST
  107. DATABASE_HOST
  108. -------------
  109. Default: ``''`` (Empty string)
  110. Which host to use when connecting to the database. An empty string means
  111. localhost. Not used with SQLite.
  112. If this value starts with a forward slash (``'/'``) and you're using MySQL,
  113. MySQL will connect via a Unix socket to the specified socket. For example::
  114. DATABASE_HOST = '/var/run/mysql'
  115. If you're using MySQL and this value *doesn't* start with a forward slash, then
  116. this value is assumed to be the host.
  117. If you're using PostgreSQL, an empty string means to use a Unix domain socket
  118. for the connection, rather than a network connection to localhost. If you
  119. explicitly need to use a TCP/IP connection on the local machine with
  120. PostgreSQL, specify ``localhost`` here.
  121. .. setting:: DATABASE_NAME
  122. DATABASE_NAME
  123. -------------
  124. Default: ``''`` (Empty string)
  125. The name of the database to use. For SQLite, it's the full path to the database
  126. file.
  127. .. setting:: DATABASE_OPTIONS
  128. DATABASE_OPTIONS
  129. ----------------
  130. Default: ``{}`` (Empty dictionary)
  131. Extra parameters to use when connecting to the database. Consult backend
  132. module's document for available keywords.
  133. .. setting:: DATABASE_PASSWORD
  134. DATABASE_PASSWORD
  135. -----------------
  136. Default: ``''`` (Empty string)
  137. The password to use when connecting to the database. Not used with SQLite.
  138. .. setting:: DATABASE_PORT
  139. DATABASE_PORT
  140. -------------
  141. Default: ``''`` (Empty string)
  142. The port to use when connecting to the database. An empty string means the
  143. default port. Not used with SQLite.
  144. .. setting:: DATABASE_USER
  145. DATABASE_USER
  146. -------------
  147. Default: ``''`` (Empty string)
  148. The username to use when connecting to the database. Not used with SQLite.
  149. .. setting:: DATE_FORMAT
  150. DATE_FORMAT
  151. -----------
  152. Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
  153. The default formatting to use for date fields on Django admin change-list
  154. pages -- and, possibly, by other parts of the system. See
  155. :ttag:`allowed date format strings <now>`.
  156. See also ``DATETIME_FORMAT``, ``TIME_FORMAT``, ``YEAR_MONTH_FORMAT``
  157. and ``MONTH_DAY_FORMAT``.
  158. .. setting:: DATETIME_FORMAT
  159. DATETIME_FORMAT
  160. ---------------
  161. Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
  162. The default formatting to use for datetime fields on Django admin change-list
  163. pages -- and, possibly, by other parts of the system. See
  164. :ttag:`allowed date format strings <now>`.
  165. See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
  166. ``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
  167. .. setting:: DEBUG
  168. DEBUG
  169. -----
  170. Default: ``False``
  171. A boolean that turns on/off debug mode.
  172. If you define custom settings, django/views/debug.py has a ``HIDDEN_SETTINGS``
  173. regular expression which will hide from the DEBUG view anything that contains
  174. ``'SECRET'``, ``'PASSWORD'``, or ``'PROFANITIES'``. This allows untrusted users to
  175. be able to give backtraces without seeing sensitive (or offensive) settings.
  176. Still, note that there are always going to be sections of your debug output that
  177. are inappropriate for public consumption. File paths, configuration options, and
  178. the like all give attackers extra information about your server.
  179. It is also important to remember that when running with ``DEBUG`` turned on, Django
  180. will remember every SQL query it executes. This is useful when you are debugging,
  181. but on a production server, it will rapidly consume memory.
  182. Never deploy a site into production with ``DEBUG`` turned on.
  183. DEBUG_PROPAGATE_EXCEPTIONS
  184. --------------------------
  185. .. versionadded:: 1.0
  186. Default: ``False``
  187. If set to True, Django's normal exception handling of view functions
  188. will be suppressed, and exceptions will propagate upwards. This can
  189. be useful for some test setups, and should never be used on a live
  190. site.
  191. .. setting:: DEFAULT_CHARSET
  192. DEFAULT_CHARSET
  193. ---------------
  194. Default: ``'utf-8'``
  195. Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
  196. manually specified. Used with ``DEFAULT_CONTENT_TYPE`` to construct the
  197. ``Content-Type`` header.
  198. .. setting:: DEFAULT_CONTENT_TYPE
  199. DEFAULT_CONTENT_TYPE
  200. --------------------
  201. Default: ``'text/html'``
  202. Default content type to use for all ``HttpResponse`` objects, if a MIME type
  203. isn't manually specified. Used with ``DEFAULT_CHARSET`` to construct the
  204. ``Content-Type`` header.
  205. .. setting:: DEFAULT_FROM_EMAIL
  206. DEFAULT_FILE_STORAGE
  207. --------------------
  208. Default: ``django.core.files.storage.FileSystemStorage``
  209. Default file storage class to be used for any file-related operations that don't
  210. specify a particular storage system. See :ref:`topics-files`.
  211. DEFAULT_FROM_EMAIL
  212. ------------------
  213. Default: ``'webmaster@localhost'``
  214. Default e-mail address to use for various automated correspondence from the
  215. site manager(s).
  216. .. setting:: DEFAULT_TABLESPACE
  217. DEFAULT_TABLESPACE
  218. ------------------
  219. .. versionadded:: 1.0
  220. Default: ``''`` (Empty string)
  221. Default tablespace to use for models that don't specify one, if the
  222. backend supports it.
  223. .. setting:: DEFAULT_INDEX_TABLESPACE
  224. DEFAULT_INDEX_TABLESPACE
  225. ------------------------
  226. .. versionadded:: 1.0
  227. Default: ``''`` (Empty string)
  228. Default tablespace to use for indexes on fields that don't specify
  229. one, if the backend supports it.
  230. .. setting:: DISALLOWED_USER_AGENTS
  231. DISALLOWED_USER_AGENTS
  232. ----------------------
  233. Default: ``()`` (Empty tuple)
  234. List of compiled regular expression objects representing User-Agent strings that
  235. are not allowed to visit any page, systemwide. Use this for bad robots/crawlers.
  236. This is only used if ``CommonMiddleware`` is installed (see
  237. :ref:`topics-http-middleware`).
  238. .. setting:: EMAIL_HOST
  239. EMAIL_HOST
  240. ----------
  241. Default: ``'localhost'``
  242. The host to use for sending e-mail.
  243. See also ``EMAIL_PORT``.
  244. .. setting:: EMAIL_HOST_PASSWORD
  245. EMAIL_HOST_PASSWORD
  246. -------------------
  247. Default: ``''`` (Empty string)
  248. Password to use for the SMTP server defined in ``EMAIL_HOST``. This setting is
  249. used in conjunction with ``EMAIL_HOST_USER`` when authenticating to the SMTP
  250. server. If either of these settings is empty, Django won't attempt
  251. authentication.
  252. See also ``EMAIL_HOST_USER``.
  253. .. setting:: EMAIL_HOST_USER
  254. EMAIL_HOST_USER
  255. ---------------
  256. Default: ``''`` (Empty string)
  257. Username to use for the SMTP server defined in ``EMAIL_HOST``. If empty,
  258. Django won't attempt authentication.
  259. See also ``EMAIL_HOST_PASSWORD``.
  260. .. setting:: EMAIL_PORT
  261. EMAIL_PORT
  262. ----------
  263. Default: ``25``
  264. Port to use for the SMTP server defined in ``EMAIL_HOST``.
  265. .. setting:: EMAIL_SUBJECT_PREFIX
  266. EMAIL_SUBJECT_PREFIX
  267. --------------------
  268. Default: ``'[Django] '``
  269. Subject-line prefix for e-mail messages sent with ``django.core.mail.mail_admins``
  270. or ``django.core.mail.mail_managers``. You'll probably want to include the
  271. trailing space.
  272. .. setting:: EMAIL_USE_TLS
  273. EMAIL_USE_TLS
  274. -------------
  275. .. versionadded:: 1.0
  276. Default: ``False``
  277. Whether to use a TLS (secure) connection when talking to the SMTP server.
  278. .. setting:: FILE_CHARSET
  279. FILE_CHARSET
  280. ------------
  281. .. versionadded:: 1.0
  282. Default: ``'utf-8'``
  283. The character encoding used to decode any files read from disk. This includes
  284. template files and initial SQL data files.
  285. .. setting:: FILE_UPLOAD_HANDLERS
  286. FILE_UPLOAD_HANDLERS
  287. --------------------
  288. .. versionadded:: 1.0
  289. Default::
  290. ("django.core.files.uploadhandler.MemoryFileUploadHandler",
  291. "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
  292. A tuple of handlers to use for uploading. See :ref:`topics-files` for details.
  293. .. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
  294. FILE_UPLOAD_MAX_MEMORY_SIZE
  295. ---------------------------
  296. .. versionadded:: 1.0
  297. Default: ``2621440`` (i.e. 2.5 MB).
  298. The maximum size (in bytes) that an upload will be before it gets streamed to
  299. the file system. See :ref:`topics-files` for details.
  300. .. setting:: FILE_UPLOAD_TEMP_DIR
  301. FILE_UPLOAD_TEMP_DIR
  302. --------------------
  303. .. versionadded:: 1.0
  304. Default: ``None``
  305. The directory to store data temporarily while uploading files. If ``None``,
  306. Django will use the standard temporary directory for the operating system. For
  307. example, this will default to '/tmp' on \*nix-style operating systems.
  308. See :ref:`topics-files` for details.
  309. .. setting:: FILE_UPLOAD_PERMISSIONS
  310. FILE_UPLOAD_PERMISSIONS
  311. -----------------------
  312. Default: ``None``
  313. The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
  314. more information about what these modes mean, see the `documentation for
  315. os.chmod`_
  316. If this isn't given or is ``None``, you'll get operating-system
  317. dependent behavior. On most platforms, temporary files will have a mode
  318. of ``0600``, and files saved from memory will be saved using the
  319. system's standard umask.
  320. .. warning::
  321. **Always prefix the mode with a 0.**
  322. If you're not familiar with file modes, please note that the leading
  323. ``0`` is very important: it indicates an octal number, which is the
  324. way that modes must be specified. If you try to use ``644``, you'll
  325. get totally incorrect behavior.
  326. .. _documentation for os.chmod: http://docs.python.org/lib/os-file-dir.html
  327. .. setting:: FIXTURE_DIRS
  328. FIXTURE_DIRS
  329. -------------
  330. Default: ``()`` (Empty tuple)
  331. List of locations of the fixture data files, in search order. Note that
  332. these paths should use Unix-style forward slashes, even on Windows. See
  333. :ref:`topics-testing`.
  334. FORCE_SCRIPT_NAME
  335. ------------------
  336. Default: ``None``
  337. If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
  338. environment variable in any HTTP request. This setting can be used to override
  339. the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
  340. of the preferred value or not supplied at all.
  341. .. setting:: IGNORABLE_404_ENDS
  342. IGNORABLE_404_ENDS
  343. ------------------
  344. Default: ``('mail.pl', 'mailform.pl', 'mail.cgi', 'mailform.cgi', 'favicon.ico', '.php')``
  345. See also ``IGNORABLE_404_STARTS`` and ``Error reporting via e-mail``.
  346. .. setting:: IGNORABLE_404_STARTS
  347. IGNORABLE_404_STARTS
  348. --------------------
  349. Default: ``('/cgi-bin/', '/_vti_bin', '/_vti_inf')``
  350. A tuple of strings that specify beginnings of URLs that should be ignored by
  351. the 404 e-mailer. See ``SEND_BROKEN_LINK_EMAILS``, ``IGNORABLE_404_ENDS`` and
  352. the :ref:`howto-error-reporting`.
  353. .. setting:: INSTALLED_APPS
  354. INSTALLED_APPS
  355. --------------
  356. Default: ``()`` (Empty tuple)
  357. A tuple of strings designating all applications that are enabled in this Django
  358. installation. Each string should be a full Python path to a Python package that
  359. contains a Django application, as created by :djadmin:`django-admin.py startapp
  360. <startapp>`.
  361. .. setting:: INTERNAL_IPS
  362. INTERNAL_IPS
  363. ------------
  364. Default: ``()`` (Empty tuple)
  365. A tuple of IP addresses, as strings, that:
  366. * See debug comments, when ``DEBUG`` is ``True``
  367. * Receive X headers if the ``XViewMiddleware`` is installed (see
  368. :ref:`topics-http-middleware`)
  369. .. setting:: JING_PATH
  370. JING_PATH
  371. ---------
  372. Default: ``'/usr/bin/jing'``
  373. Path to the "Jing" executable. Jing is a RELAX NG validator, and Django uses it
  374. to validate each ``XMLField`` in your models.
  375. See http://www.thaiopensource.com/relaxng/jing.html .
  376. .. setting:: LANGUAGE_CODE
  377. LANGUAGE_CODE
  378. -------------
  379. Default: ``'en-us'``
  380. A string representing the language code for this installation. This should be in
  381. standard language format. For example, U.S. English is ``"en-us"``. See
  382. :ref:`topics-i18n`.
  383. .. setting:: LANGUAGE_COOKIE_NAME
  384. LANGUAGE_COOKIE_NAME
  385. --------------------
  386. .. versionadded:: 1.0
  387. Default: ``'django_language'``
  388. The name of the cookie to use for the language cookie. This can be whatever you
  389. want (but should be different from ``SESSION_COOKIE_NAME``). See
  390. :ref:`topics-i18n`.
  391. .. setting:: LANGUAGES
  392. LANGUAGES
  393. ---------
  394. Default: A tuple of all available languages. This list is continually growing
  395. and including a copy here would inevitably become rapidly out of date. You can
  396. see the current list of translated languages by looking in
  397. ``django/conf/global_settings.py`` (or view the `online source`_).
  398. .. _online source: http://code.djangoproject.com/browser/django/trunk/django/conf/global_settings.py
  399. The list is a tuple of two-tuples in the format (language code, language
  400. name) -- for example, ``('ja', 'Japanese')``. This specifies which languages
  401. are available for language selection. See :ref:`topics-i18n`.
  402. Generally, the default value should suffice. Only set this setting if you want
  403. to restrict language selection to a subset of the Django-provided languages.
  404. If you define a custom ``LANGUAGES`` setting, it's OK to mark the languages as
  405. translation strings (as in the default value displayed above) -- but use a
  406. "dummy" ``gettext()`` function, not the one in ``django.utils.translation``.
  407. You should *never* import ``django.utils.translation`` from within your
  408. settings file, because that module in itself depends on the settings, and that
  409. would cause a circular import.
  410. The solution is to use a "dummy" ``gettext()`` function. Here's a sample
  411. settings file::
  412. gettext = lambda s: s
  413. LANGUAGES = (
  414. ('de', gettext('German')),
  415. ('en', gettext('English')),
  416. )
  417. With this arrangement, ``django-admin.py makemessages`` will still find and
  418. mark these strings for translation, but the translation won't happen at
  419. runtime -- so you'll have to remember to wrap the languages in the *real*
  420. ``gettext()`` in any code that uses ``LANGUAGES`` at runtime.
  421. .. setting:: LOCALE_PATHS
  422. LOCALE_PATHS
  423. ------------
  424. Default: ``()`` (Empty tuple)
  425. A tuple of directories where Django looks for translation files.
  426. See :ref:`translations-in-your-own-projects`.
  427. .. setting:: LOGIN_REDIRECT_URL
  428. LOGIN_REDIRECT_URL
  429. ------------------
  430. .. versionadded:: 1.0
  431. Default: ``'/accounts/profile/'``
  432. The URL where requests are redirected after login when the
  433. ``contrib.auth.login`` view gets no ``next`` parameter.
  434. This is used by the :func:`~django.contrib.auth.decorators.login_required`
  435. decorator, for example.
  436. .. setting:: LOGIN_URL
  437. LOGIN_URL
  438. ---------
  439. .. versionadded:: 1.0
  440. Default: ``'/accounts/login/'``
  441. The URL where requests are redirected for login, specially when using the
  442. :func:`~django.contrib.auth.decorators.login_required` decorator.
  443. .. setting:: LOGOUT_URL
  444. LOGOUT_URL
  445. ----------
  446. .. versionadded:: 1.0
  447. Default: ``'/accounts/logout/'``
  448. LOGIN_URL counterpart.
  449. .. setting:: MANAGERS
  450. MANAGERS
  451. --------
  452. Default: ``()`` (Empty tuple)
  453. A tuple in the same format as ``ADMINS`` that specifies who should get
  454. broken-link notifications when ``SEND_BROKEN_LINK_EMAILS=True``.
  455. .. setting:: MEDIA_ROOT
  456. MEDIA_ROOT
  457. ----------
  458. Default: ``''`` (Empty string)
  459. Absolute path to the directory that holds media for this installation.
  460. Example: ``"/home/media/media.lawrence.com/"`` See also ``MEDIA_URL``.
  461. .. setting:: MEDIA_URL
  462. MEDIA_URL
  463. ---------
  464. Default: ``''`` (Empty string)
  465. URL that handles the media served from ``MEDIA_ROOT``.
  466. Example: ``"http://media.lawrence.com"``
  467. Note that this should have a trailing slash if it has a path component.
  468. Good: ``"http://www.example.com/static/"``
  469. Bad: ``"http://www.example.com/static"``
  470. .. setting:: MIDDLEWARE_CLASSES
  471. MIDDLEWARE_CLASSES
  472. ------------------
  473. Default::
  474. ("django.contrib.sessions.middleware.SessionMiddleware",
  475. "django.contrib.auth.middleware.AuthenticationMiddleware",
  476. "django.middleware.common.CommonMiddleware",
  477. "django.middleware.doc.XViewMiddleware")
  478. A tuple of middleware classes to use. See :ref:`topics-http-middleware`.
  479. .. setting:: MONTH_DAY_FORMAT
  480. MONTH_DAY_FORMAT
  481. ----------------
  482. Default: ``'F j'``
  483. The default formatting to use for date fields on Django admin change-list
  484. pages -- and, possibly, by other parts of the system -- in cases when only the
  485. month and day are displayed.
  486. For example, when a Django admin change-list page is being filtered by a date
  487. drilldown, the header for a given day displays the day and month. Different
  488. locales have different formats. For example, U.S. English would say
  489. "January 1," whereas Spanish might say "1 Enero."
  490. See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
  491. ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``YEAR_MONTH_FORMAT``.
  492. .. setting:: PREPEND_WWW
  493. PREPEND_WWW
  494. -----------
  495. Default: ``False``
  496. Whether to prepend the "www." subdomain to URLs that don't have it. This is only
  497. used if ``CommonMiddleware`` is installed (see :ref:`topics-http-middleware`).
  498. See also ``APPEND_SLASH``.
  499. .. setting:: PROFANITIES_LIST
  500. PROFANITIES_LIST
  501. ----------------
  502. A tuple of profanities, as strings, that will trigger a validation error when
  503. the ``hasNoProfanities`` validator is called.
  504. We don't list the default values here, because that would be profane. To see
  505. the default values, see the file ``django/conf/global_settings.py``.
  506. .. setting:: ROOT_URLCONF
  507. ROOT_URLCONF
  508. ------------
  509. Default: Not defined
  510. A string representing the full Python import path to your root URLconf. For example:
  511. ``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
  512. setting the attribute ``urlconf`` on the incoming ``HttpRequest``
  513. object. See :ref:`how-django-processes-a-request` for details.
  514. .. setting:: SECRET_KEY
  515. SECRET_KEY
  516. ----------
  517. Default: ``''`` (Empty string)
  518. A secret key for this particular Django installation. Used to provide a seed in
  519. secret-key hashing algorithms. Set this to a random string -- the longer, the
  520. better. ``django-admin.py startproject`` creates one automatically.
  521. .. setting:: SEND_BROKEN_LINK_EMAILS
  522. SEND_BROKEN_LINK_EMAILS
  523. -----------------------
  524. Default: ``False``
  525. Whether to send an e-mail to the ``MANAGERS`` each time somebody visits a
  526. Django-powered page that is 404ed with a non-empty referer (i.e., a broken
  527. link). This is only used if ``CommonMiddleware`` is installed (see
  528. :ref:`topics-http-middleware`. See also ``IGNORABLE_404_STARTS``,
  529. ``IGNORABLE_404_ENDS`` and :ref:`howto-error-reporting`.
  530. .. setting:: SERIALIZATION_MODULES
  531. SERIALIZATION_MODULES
  532. ---------------------
  533. Default: Not defined.
  534. A dictionary of modules containing serializer definitions (provided as
  535. strings), keyed by a string identifier for that serialization type. For
  536. example, to define a YAML serializer, use::
  537. SERIALIZATION_MODULES = { 'yaml' : 'path.to.yaml_serializer' }
  538. .. setting:: SERVER_EMAIL
  539. SERVER_EMAIL
  540. ------------
  541. Default: ``'root@localhost'``
  542. The e-mail address that error messages come from, such as those sent to
  543. ``ADMINS`` and ``MANAGERS``.
  544. .. setting:: SESSION_ENGINE
  545. SESSION_ENGINE
  546. --------------
  547. .. versionadded:: 1.0
  548. Default: ``django.contrib.sessions.backends.db``
  549. Controls where Django stores session data. Valid values are:
  550. * ``'django.contrib.sessions.backends.db'``
  551. * ``'django.contrib.sessions.backends.file'``
  552. * ``'django.contrib.sessions.backends.cache'``
  553. See :ref:`topics-http-sessions`.
  554. .. setting:: SESSION_COOKIE_AGE
  555. SESSION_COOKIE_AGE
  556. ------------------
  557. Default: ``1209600`` (2 weeks, in seconds)
  558. The age of session cookies, in seconds. See :ref:`topics-http-sessions`.
  559. .. setting:: SESSION_COOKIE_DOMAIN
  560. SESSION_COOKIE_DOMAIN
  561. ---------------------
  562. Default: ``None``
  563. The domain to use for session cookies. Set this to a string such as
  564. ``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard
  565. domain cookie. See the :ref:`topics-http-sessions`.
  566. .. setting:: SESSION_COOKIE_NAME
  567. SESSION_COOKIE_NAME
  568. -------------------
  569. Default: ``'sessionid'``
  570. The name of the cookie to use for sessions. This can be whatever you want (but
  571. should be different from ``LANGUAGE_COOKIE_NAME``). See the :ref:`topics-http-sessions`.
  572. .. setting:: SESSION_COOKIE_PATH
  573. SESSION_COOKIE_PATH
  574. -------------------
  575. .. versionadded:: 1.0
  576. Default: ``'/'``
  577. The path set on the session cookie. This should either match the URL path of your
  578. Django installation or be parent of that path.
  579. This is useful if you have multiple Django instances running under the same
  580. hostname. They can use different cookie paths, and each instance will only see
  581. its own session cookie.
  582. .. setting:: SESSION_COOKIE_SECURE
  583. SESSION_COOKIE_SECURE
  584. ---------------------
  585. Default: ``False``
  586. Whether to use a secure cookie for the session cookie. If this is set to
  587. ``True``, the cookie will be marked as "secure," which means browsers may
  588. ensure that the cookie is only sent under an HTTPS connection.
  589. See the :ref:`topics-http-sessions`.
  590. .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
  591. SESSION_EXPIRE_AT_BROWSER_CLOSE
  592. -------------------------------
  593. Default: ``False``
  594. Whether to expire the session when the user closes his or her browser.
  595. See the :ref:`topics-http-sessions`.
  596. .. setting:: SESSION_FILE_PATH
  597. SESSION_FILE_PATH
  598. -----------------
  599. .. versionadded:: 1.0
  600. Default: ``None``
  601. If you're using file-based session storage, this sets the directory in
  602. which Django will store session data. See :ref:`topics-http-sessions`. When
  603. the default value (``None``) is used, Django will use the standard temporary
  604. directory for the system.
  605. .. setting:: SESSION_SAVE_EVERY_REQUEST
  606. SESSION_SAVE_EVERY_REQUEST
  607. --------------------------
  608. Default: ``False``
  609. Whether to save the session data on every request. See
  610. :ref:`topics-http-sessions`.
  611. .. setting:: SITE_ID
  612. SITE_ID
  613. -------
  614. Default: Not defined
  615. The ID, as an integer, of the current site in the ``django_site`` database
  616. table. This is used so that application data can hook into specific site(s)
  617. and a single database can manage content for multiple sites.
  618. See :ref:`ref-contrib-sites`.
  619. .. _site framework docs: ../sites/
  620. .. setting:: TEMPLATE_CONTEXT_PROCESSORS
  621. TEMPLATE_CONTEXT_PROCESSORS
  622. ---------------------------
  623. Default::
  624. ("django.core.context_processors.auth",
  625. "django.core.context_processors.debug",
  626. "django.core.context_processors.i18n",
  627. "django.core.context_processors.media")
  628. A tuple of callables that are used to populate the context in ``RequestContext``.
  629. These callables take a request object as their argument and return a dictionary
  630. of items to be merged into the context.
  631. .. setting:: TEMPLATE_DEBUG
  632. TEMPLATE_DEBUG
  633. --------------
  634. Default: ``False``
  635. A boolean that turns on/off template debug mode. If this is ``True``, the fancy
  636. error page will display a detailed report for any ``TemplateSyntaxError``. This
  637. report contains the relevant snippet of the template, with the appropriate line
  638. highlighted.
  639. Note that Django only displays fancy error pages if ``DEBUG`` is ``True``, so
  640. you'll want to set that to take advantage of this setting.
  641. See also ``DEBUG``.
  642. .. setting:: TEMPLATE_DIRS
  643. TEMPLATE_DIRS
  644. -------------
  645. Default: ``()`` (Empty tuple)
  646. List of locations of the template source files, in search order. Note that
  647. these paths should use Unix-style forward slashes, even on Windows.
  648. See :ref:`topics-templates`..
  649. .. setting:: TEMPLATE_LOADERS
  650. TEMPLATE_LOADERS
  651. ----------------
  652. Default::
  653. ('django.template.loaders.filesystem.load_template_source',
  654. 'django.template.loaders.app_directories.load_template_source')
  655. A tuple of callables (as strings) that know how to import templates from
  656. various sources. See :ref:`ref-templates-api`.
  657. .. setting:: TEMPLATE_STRING_IF_INVALID
  658. TEMPLATE_STRING_IF_INVALID
  659. --------------------------
  660. Default: ``''`` (Empty string)
  661. Output, as a string, that the template system should use for invalid (e.g.
  662. misspelled) variables. See :ref:`invalid-template-variables`..
  663. .. setting:: TEST_DATABASE_CHARSET
  664. TEST_DATABASE_CHARSET
  665. ---------------------
  666. .. versionadded:: 1.0
  667. Default: ``None``
  668. The character set encoding used to create the test database. The value of this
  669. string is passed directly through to the database, so its format is
  670. backend-specific.
  671. Supported for the PostgreSQL_ (``postgresql``, ``postgresql_psycopg2``) and MySQL_ (``mysql``) backends.
  672. .. _PostgreSQL: http://www.postgresql.org/docs/8.2/static/multibyte.html
  673. .. _MySQL: http://www.mysql.org/doc/refman/5.0/en/charset-database.html
  674. .. setting:: TEST_DATABASE_COLLATION
  675. TEST_DATABASE_COLLATION
  676. ------------------------
  677. .. versionadded:: 1.0
  678. Default: ``None``
  679. The collation order to use when creating the test database. This value is
  680. passed directly to the backend, so its format is backend-specific.
  681. Only supported for the ``mysql`` backend (see `section 10.3.2`_ of the MySQL
  682. manual for details).
  683. .. _section 10.3.2: http://www.mysql.org/doc/refman/5.0/en/charset-database.html
  684. .. setting:: TEST_DATABASE_NAME
  685. TEST_DATABASE_NAME
  686. ------------------
  687. Default: ``None``
  688. The name of database to use when running the test suite.
  689. If the default value (``None``) is used with the SQLite database engine, the
  690. tests will use a memory resident database. For all other database engines the
  691. test database will use the name ``'test_' + settings.DATABASE_NAME``.
  692. See :ref:`topics-testing`.
  693. .. setting:: TEST_RUNNER
  694. TEST_RUNNER
  695. -----------
  696. Default: ``'django.test.simple.run_tests'``
  697. The name of the method to use for starting the test suite. See
  698. :ref:`topics-testing`.
  699. .. _Testing Django Applications: ../testing/
  700. .. setting:: TIME_FORMAT
  701. TIME_FORMAT
  702. -----------
  703. Default: ``'P'`` (e.g. ``4 p.m.``)
  704. The default formatting to use for time fields on Django admin change-list
  705. pages -- and, possibly, by other parts of the system. See
  706. :ttag:`allowed date format strings <now>`.
  707. See also ``DATE_FORMAT``, ``DATETIME_FORMAT``, ``TIME_FORMAT``,
  708. ``YEAR_MONTH_FORMAT`` and ``MONTH_DAY_FORMAT``.
  709. .. setting:: TIME_ZONE
  710. TIME_ZONE
  711. ---------
  712. Default: ``'America/Chicago'``
  713. A string representing the time zone for this installation. `See available choices`_.
  714. (Note that list of available choices lists more than one on the same line;
  715. you'll want to use just one of the choices for a given time zone. For instance,
  716. one line says ``'Europe/London GB GB-Eire'``, but you should use the first bit
  717. of that -- ``'Europe/London'`` -- as your ``TIME_ZONE`` setting.)
  718. Note that this is the time zone to which Django will convert all dates/times --
  719. not necessarily the timezone of the server. For example, one server may serve
  720. multiple Django-powered sites, each with a separate time-zone setting.
  721. Normally, Django sets the ``os.environ['TZ']`` variable to the time zone you
  722. specify in the ``TIME_ZONE`` setting. Thus, all your views and models will
  723. automatically operate in the correct time zone. However, if you're using the
  724. manual configuration option (see below), Django will *not* touch the ``TZ``
  725. environment variable, and it'll be up to you to ensure your processes are
  726. running in the correct environment.
  727. .. note::
  728. Django cannot reliably use alternate time zones in a Windows environment.
  729. If you're running Django on Windows, this variable must be set to match the
  730. system timezone.
  731. .. _See available choices: http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
  732. .. setting:: URL_VALIDATOR_USER_AGENT
  733. URL_VALIDATOR_USER_AGENT
  734. ------------------------
  735. Default: ``Django/<version> (http://www.djangoproject.com/)``
  736. The string to use as the ``User-Agent`` header when checking to see if URLs
  737. exist (see the ``verify_exists`` option on :class:`~django.db.models.URLField`).
  738. .. setting:: USE_ETAGS
  739. USE_ETAGS
  740. ---------
  741. Default: ``False``
  742. A boolean that specifies whether to output the "Etag" header. This saves
  743. bandwidth but slows down performance. This is only used if ``CommonMiddleware``
  744. is installed (see :ref:`topics-http-middleware`).
  745. .. setting:: USE_I18N
  746. USE_I18N
  747. --------
  748. Default: ``True``
  749. A boolean that specifies whether Django's internationalization system should be
  750. enabled. This provides an easy way to turn it off, for performance. If this is
  751. set to ``False``, Django will make some optimizations so as not to load the
  752. internationalization machinery.
  753. .. setting:: YEAR_MONTH_FORMAT
  754. YEAR_MONTH_FORMAT
  755. -----------------
  756. Default: ``'F Y'``
  757. The default formatting to use for date fields on Django admin change-list
  758. pages -- and, possibly, by other parts of the system -- in cases when only the
  759. year and month are displayed.
  760. For example, when a Django admin change-list page is being filtered by a date
  761. drilldown, the header for a given month displays the month and the year.
  762. Different locales have different formats. For example, U.S. English would say
  763. "January 2006," whereas another locale might say "2006/January."
  764. See :ttag:`allowed date format strings <now>`. See also ``DATE_FORMAT``,
  765. ``DATETIME_FORMAT``, ``TIME_FORMAT`` and ``MONTH_DAY_FORMAT``.