settings.txt 72 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596
  1. ========
  2. Settings
  3. ========
  4. .. contents::
  5. :local:
  6. :depth: 1
  7. .. warning::
  8. Be careful when you override settings, especially when the default value
  9. is a non-empty tuple or dictionary, such as :setting:`MIDDLEWARE_CLASSES`
  10. and :setting:`TEMPLATE_CONTEXT_PROCESSORS`. Make sure you keep the
  11. components required by the features of Django you wish to use.
  12. Core settings
  13. =============
  14. Here's a list of settings available in Django core and their default values.
  15. Settings provided by contrib apps are listed below, followed by a topical index
  16. of the core settings.
  17. .. setting:: ABSOLUTE_URL_OVERRIDES
  18. ABSOLUTE_URL_OVERRIDES
  19. ----------------------
  20. Default: ``{}`` (Empty dictionary)
  21. A dictionary mapping ``"app_label.model_name"`` strings to functions that take
  22. a model object and return its URL. This is a way of overriding
  23. ``get_absolute_url()`` methods on a per-installation basis. Example::
  24. ABSOLUTE_URL_OVERRIDES = {
  25. 'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
  26. 'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
  27. }
  28. Note that the model name used in this setting should be all lower-case, regardless
  29. of the case of the actual model class name.
  30. .. setting:: ADMINS
  31. ADMINS
  32. ------
  33. Default: ``()`` (Empty tuple)
  34. A tuple that lists people who get code error notifications. When
  35. ``DEBUG=False`` and a view raises an exception, Django will email these people
  36. with the full exception information. Each member of the tuple should be a tuple
  37. of (Full name, email address). Example::
  38. (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
  39. Note that Django will email *all* of these people whenever an error happens.
  40. See :doc:`/howto/error-reporting` for more information.
  41. .. setting:: ALLOWED_INCLUDE_ROOTS
  42. ALLOWED_INCLUDE_ROOTS
  43. ---------------------
  44. Default: ``()`` (Empty tuple)
  45. A tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
  46. tag. This is a security measure, so that template authors can't access files
  47. that they shouldn't be accessing.
  48. For example, if :setting:`ALLOWED_INCLUDE_ROOTS` is ``('/home/html', '/var/www')``,
  49. then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
  50. wouldn't.
  51. .. setting:: APPEND_SLASH
  52. APPEND_SLASH
  53. ------------
  54. Default: ``True``
  55. When set to ``True``, if the request URL does not match any of the patterns
  56. in the URLconf and it doesn't end in a slash, an HTTP redirect is issued to the
  57. same URL with a slash appended. Note that the redirect may cause any data
  58. submitted in a POST request to be lost.
  59. The :setting:`APPEND_SLASH` setting is only used if
  60. :class:`~django.middleware.common.CommonMiddleware` is installed
  61. (see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`.
  62. .. setting:: CACHES
  63. CACHES
  64. ------
  65. Default::
  66. {
  67. 'default': {
  68. 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
  69. }
  70. }
  71. A dictionary containing the settings for all caches to be used with
  72. Django. It is a nested dictionary whose contents maps cache aliases
  73. to a dictionary containing the options for an individual cache.
  74. The :setting:`CACHES` setting must configure a ``default`` cache;
  75. any number of additional caches may also be specified. If you
  76. are using a cache backend other than the local memory cache, or
  77. you need to define multiple caches, other options will be required.
  78. The following cache options are available.
  79. .. setting:: CACHES-BACKEND
  80. BACKEND
  81. ~~~~~~~
  82. Default: ``''`` (Empty string)
  83. The cache backend to use. The built-in cache backends are:
  84. * ``'django.core.cache.backends.db.DatabaseCache'``
  85. * ``'django.core.cache.backends.dummy.DummyCache'``
  86. * ``'django.core.cache.backends.filebased.FileBasedCache'``
  87. * ``'django.core.cache.backends.locmem.LocMemCache'``
  88. * ``'django.core.cache.backends.memcached.MemcachedCache'``
  89. * ``'django.core.cache.backends.memcached.PyLibMCCache'``
  90. You can use a cache backend that doesn't ship with Django by setting
  91. :setting:`BACKEND <CACHES-BACKEND>` to a fully-qualified path of a cache
  92. backend class (i.e. ``mypackage.backends.whatever.WhateverCache``).
  93. Writing a whole new cache backend from scratch is left as an exercise
  94. to the reader; see the other backends for examples.
  95. .. setting:: CACHES-KEY_FUNCTION
  96. KEY_FUNCTION
  97. ~~~~~~~~~~~~
  98. A string containing a dotted path to a function that defines how to
  99. compose a prefix, version and key into a final cache key. The default
  100. implementation is equivalent to the function::
  101. def make_key(key, key_prefix, version):
  102. return ':'.join([key_prefix, str(version), key])
  103. You may use any key function you want, as long as it has the same
  104. argument signature.
  105. See the :ref:`cache documentation <cache_key_transformation>` for more
  106. information.
  107. .. setting:: CACHES-KEY_PREFIX
  108. KEY_PREFIX
  109. ~~~~~~~~~~
  110. Default: ``''`` (Empty string)
  111. A string that will be automatically included (prepended by default) to
  112. all cache keys used by the Django server.
  113. See the :ref:`cache documentation <cache_key_prefixing>` for more information.
  114. .. setting:: CACHES-LOCATION
  115. LOCATION
  116. ~~~~~~~~
  117. Default: ``''`` (Empty string)
  118. The location of the cache to use. This might be the directory for a
  119. file system cache, a host and port for a memcache server, or simply an
  120. identifying name for a local memory cache. e.g.::
  121. CACHES = {
  122. 'default': {
  123. 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
  124. 'LOCATION': '/var/tmp/django_cache',
  125. }
  126. }
  127. .. setting:: CACHES-OPTIONS
  128. OPTIONS
  129. ~~~~~~~
  130. Default: None
  131. Extra parameters to pass to the cache backend. Available parameters
  132. vary depending on your cache backend.
  133. Some information on available parameters can be found in the
  134. :doc:`Cache Backends </topics/cache>` documentation. For more information,
  135. consult your backend module's own documentation.
  136. .. setting:: CACHES-TIMEOUT
  137. TIMEOUT
  138. ~~~~~~~
  139. Default: 300
  140. The number of seconds before a cache entry is considered stale.
  141. .. setting:: CACHES-VERSION
  142. VERSION
  143. ~~~~~~~
  144. Default: ``1``
  145. The default version number for cache keys generated by the Django server.
  146. See the :ref:`cache documentation <cache_versioning>` for more information.
  147. .. setting:: CACHE_MIDDLEWARE_ALIAS
  148. CACHE_MIDDLEWARE_ALIAS
  149. ----------------------
  150. Default: ``default``
  151. The cache connection to use for the cache middleware.
  152. .. setting:: CACHE_MIDDLEWARE_ANONYMOUS_ONLY
  153. CACHE_MIDDLEWARE_ANONYMOUS_ONLY
  154. -------------------------------
  155. Default: ``False``
  156. If the value of this setting is ``True``, only anonymous requests (i.e., not
  157. those made by a logged-in user) will be cached. Otherwise, the middleware
  158. caches every page that doesn't have GET or POST parameters.
  159. If you set the value of this setting to ``True``, you should make sure you've
  160. activated ``AuthenticationMiddleware``.
  161. See :doc:`/topics/cache`.
  162. .. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
  163. CACHE_MIDDLEWARE_KEY_PREFIX
  164. ---------------------------
  165. Default: ``''`` (Empty string)
  166. The cache key prefix that the cache middleware should use.
  167. See :doc:`/topics/cache`.
  168. .. setting:: CACHE_MIDDLEWARE_SECONDS
  169. CACHE_MIDDLEWARE_SECONDS
  170. ------------------------
  171. Default: ``600``
  172. The default number of seconds to cache a page when the caching middleware or
  173. ``cache_page()`` decorator is used.
  174. See :doc:`/topics/cache`.
  175. .. _settings-csrf:
  176. .. setting:: CSRF_COOKIE_DOMAIN
  177. CSRF_COOKIE_DOMAIN
  178. ------------------
  179. Default: ``None``
  180. The domain to be used when setting the CSRF cookie. This can be useful for
  181. easily allowing cross-subdomain requests to be excluded from the normal cross
  182. site request forgery protection. It should be set to a string such as
  183. ``".example.com"`` to allow a POST request from a form on one subdomain to be
  184. accepted by a view served from another subdomain.
  185. Please note that the presence of this setting does not imply that Django's CSRF
  186. protection is safe from cross-subdomain attacks by default - please see the
  187. :ref:`CSRF limitations <csrf-limitations>` section.
  188. .. setting:: CSRF_COOKIE_NAME
  189. CSRF_COOKIE_NAME
  190. ----------------
  191. Default: ``'csrftoken'``
  192. The name of the cookie to use for the CSRF authentication token. This can be whatever you
  193. want. See :doc:`/ref/contrib/csrf`.
  194. .. setting:: CSRF_COOKIE_PATH
  195. CSRF_COOKIE_PATH
  196. ----------------
  197. Default: ``'/'``
  198. The path set on the CSRF cookie. This should either match the URL path of your
  199. Django installation or be a parent of that path.
  200. This is useful if you have multiple Django instances running under the same
  201. hostname. They can use different cookie paths, and each instance will only see
  202. its own CSRF cookie.
  203. .. setting:: CSRF_COOKIE_SECURE
  204. CSRF_COOKIE_SECURE
  205. ------------------
  206. Default: ``False``
  207. Whether to use a secure cookie for the CSRF cookie. If this is set to ``True``,
  208. the cookie will be marked as "secure," which means browsers may ensure that the
  209. cookie is only sent under an HTTPS connection.
  210. .. setting:: CSRF_FAILURE_VIEW
  211. CSRF_FAILURE_VIEW
  212. -----------------
  213. Default: ``'django.views.csrf.csrf_failure'``
  214. A dotted path to the view function to be used when an incoming request
  215. is rejected by the CSRF protection. The function should have this signature::
  216. def csrf_failure(request, reason="")
  217. where ``reason`` is a short message (intended for developers or logging, not for
  218. end users) indicating the reason the request was rejected. See
  219. :doc:`/ref/contrib/csrf`.
  220. .. setting:: DATABASES
  221. DATABASES
  222. ---------
  223. Default: ``{}`` (Empty dictionary)
  224. A dictionary containing the settings for all databases to be used with
  225. Django. It is a nested dictionary whose contents maps database aliases
  226. to a dictionary containing the options for an individual database.
  227. The :setting:`DATABASES` setting must configure a ``default`` database;
  228. any number of additional databases may also be specified.
  229. The simplest possible settings file is for a single-database setup using
  230. SQLite. This can be configured using the following::
  231. DATABASES = {
  232. 'default': {
  233. 'ENGINE': 'django.db.backends.sqlite3',
  234. 'NAME': 'mydatabase'
  235. }
  236. }
  237. For other database backends, or more complex SQLite configurations, other options
  238. will be required. The following inner options are available.
  239. .. setting:: DATABASE-ENGINE
  240. ENGINE
  241. ~~~~~~
  242. Default: ``''`` (Empty string)
  243. The database backend to use. The built-in database backends are:
  244. * ``'django.db.backends.postgresql_psycopg2'``
  245. * ``'django.db.backends.mysql'``
  246. * ``'django.db.backends.sqlite3'``
  247. * ``'django.db.backends.oracle'``
  248. You can use a database backend that doesn't ship with Django by setting
  249. ``ENGINE`` to a fully-qualified path (i.e.
  250. ``mypackage.backends.whatever``). Writing a whole new database backend from
  251. scratch is left as an exercise to the reader; see the other backends for
  252. examples.
  253. .. setting:: HOST
  254. HOST
  255. ~~~~
  256. Default: ``''`` (Empty string)
  257. Which host to use when connecting to the database. An empty string means
  258. localhost. Not used with SQLite.
  259. If this value starts with a forward slash (``'/'``) and you're using MySQL,
  260. MySQL will connect via a Unix socket to the specified socket. For example::
  261. "HOST": '/var/run/mysql'
  262. If you're using MySQL and this value *doesn't* start with a forward slash, then
  263. this value is assumed to be the host.
  264. If you're using PostgreSQL, by default (empty :setting:`HOST`), the connection
  265. to the database is done through UNIX domain sockets ('local' lines in
  266. ``pg_hba.conf``). If you want to connect through TCP sockets, set
  267. :setting:`HOST` to 'localhost' or '127.0.0.1' ('host' lines in ``pg_hba.conf``).
  268. On Windows, you should always define :setting:`HOST`, as UNIX domain sockets
  269. are not available.
  270. .. setting:: NAME
  271. NAME
  272. ~~~~
  273. Default: ``''`` (Empty string)
  274. The name of the database to use. For SQLite, it's the full path to the database
  275. file. When specifying the path, always use forward slashes, even on Windows
  276. (e.g. ``C:/homes/user/mysite/sqlite3.db``).
  277. .. setting:: OPTIONS
  278. OPTIONS
  279. ~~~~~~~
  280. Default: ``{}`` (Empty dictionary)
  281. Extra parameters to use when connecting to the database. Available parameters
  282. vary depending on your database backend.
  283. Some information on available parameters can be found in the
  284. :doc:`Database Backends </ref/databases>` documentation. For more information,
  285. consult your backend module's own documentation.
  286. .. setting:: PASSWORD
  287. PASSWORD
  288. ~~~~~~~~
  289. Default: ``''`` (Empty string)
  290. The password to use when connecting to the database. Not used with SQLite.
  291. .. setting:: PORT
  292. PORT
  293. ~~~~
  294. Default: ``''`` (Empty string)
  295. The port to use when connecting to the database. An empty string means the
  296. default port. Not used with SQLite.
  297. .. setting:: USER
  298. USER
  299. ~~~~
  300. Default: ``''`` (Empty string)
  301. The username to use when connecting to the database. Not used with SQLite.
  302. .. setting:: TEST_CHARSET
  303. TEST_CHARSET
  304. ~~~~~~~~~~~~
  305. Default: ``None``
  306. The character set encoding used to create the test database. The value of this
  307. string is passed directly through to the database, so its format is
  308. backend-specific.
  309. Supported for the PostgreSQL_ (``postgresql_psycopg2``) and MySQL_ (``mysql``)
  310. backends.
  311. .. _PostgreSQL: http://www.postgresql.org/docs/8.2/static/multibyte.html
  312. .. _MySQL: http://dev.mysql.com/doc/refman/5.0/en/charset-database.html
  313. .. setting:: TEST_COLLATION
  314. TEST_COLLATION
  315. ~~~~~~~~~~~~~~
  316. Default: ``None``
  317. The collation order to use when creating the test database. This value is
  318. passed directly to the backend, so its format is backend-specific.
  319. Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
  320. .. _MySQL manual: MySQL_
  321. .. setting:: TEST_DEPENDENCIES
  322. TEST_DEPENDENCIES
  323. ~~~~~~~~~~~~~~~~~
  324. Default: ``['default']``, for all databases other than ``default``,
  325. which has no dependencies.
  326. The creation-order dependencies of the database. See the documentation
  327. on :ref:`controlling the creation order of test databases
  328. <topics-testing-creation-dependencies>` for details.
  329. .. setting:: TEST_MIRROR
  330. TEST_MIRROR
  331. ~~~~~~~~~~~
  332. Default: ``None``
  333. The alias of the database that this database should mirror during
  334. testing.
  335. This setting exists to allow for testing of master/slave
  336. configurations of multiple databases. See the documentation on
  337. :ref:`testing master/slave configurations
  338. <topics-testing-masterslave>` for details.
  339. .. setting:: TEST_NAME
  340. TEST_NAME
  341. ~~~~~~~~~
  342. Default: ``None``
  343. The name of database to use when running the test suite.
  344. If the default value (``None``) is used with the SQLite database engine, the
  345. tests will use a memory resident database. For all other database engines the
  346. test database will use the name ``'test_' + DATABASE_NAME``.
  347. See :ref:`the-test-database`.
  348. .. setting:: TEST_CREATE
  349. TEST_CREATE
  350. ~~~~~~~~~~~
  351. Default: ``True``
  352. This is an Oracle-specific setting.
  353. If it is set to ``False``, the test tablespaces won't be automatically created
  354. at the beginning of the tests and dropped at the end.
  355. .. setting:: TEST_USER
  356. TEST_USER
  357. ~~~~~~~~~
  358. Default: ``None``
  359. This is an Oracle-specific setting.
  360. The username to use when connecting to the Oracle database that will be used
  361. when running tests. If not provided, Django will use ``'test_' + USER``.
  362. .. setting:: TEST_USER_CREATE
  363. TEST_USER_CREATE
  364. ~~~~~~~~~~~~~~~~
  365. Default: ``True``
  366. This is an Oracle-specific setting.
  367. If it is set to ``False``, the test user won't be automatically created at the
  368. beginning of the tests and dropped at the end.
  369. .. setting:: TEST_PASSWD
  370. TEST_PASSWD
  371. ~~~~~~~~~~~
  372. Default: ``None``
  373. This is an Oracle-specific setting.
  374. The password to use when connecting to the Oracle database that will be used
  375. when running tests. If not provided, Django will use a hardcoded default value.
  376. .. setting:: TEST_TBLSPACE
  377. TEST_TBLSPACE
  378. ~~~~~~~~~~~~~
  379. Default: ``None``
  380. This is an Oracle-specific setting.
  381. The name of the tablespace that will be used when running tests. If not
  382. provided, Django will use ``'test_' + NAME``.
  383. .. setting:: TEST_TBLSPACE_TMP
  384. TEST_TBLSPACE_TMP
  385. ~~~~~~~~~~~~~~~~~
  386. Default: ``None``
  387. This is an Oracle-specific setting.
  388. The name of the temporary tablespace that will be used when running tests. If
  389. not provided, Django will use ``'test_' + NAME + '_temp'``.
  390. .. setting:: DATABASE_ROUTERS
  391. DATABASE_ROUTERS
  392. ----------------
  393. Default: ``[]`` (Empty list)
  394. The list of routers that will be used to determine which database
  395. to use when performing a database queries.
  396. See the documentation on :ref:`automatic database routing in multi
  397. database configurations <topics-db-multi-db-routing>`.
  398. .. setting:: DATE_FORMAT
  399. DATE_FORMAT
  400. -----------
  401. Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
  402. The default formatting to use for displaying date fields in any part of the
  403. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  404. locale-dictated format has higher precedence and will be applied instead. See
  405. :tfilter:`allowed date format strings <date>`.
  406. See also :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  407. .. setting:: DATE_INPUT_FORMATS
  408. DATE_INPUT_FORMATS
  409. ------------------
  410. Default::
  411. ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
  412. '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
  413. '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
  414. A tuple of formats that will be accepted when inputting data on a date field.
  415. Formats will be tried in order, using the first valid one. Note that these
  416. format strings use Python's datetime_ module syntax, not the format strings
  417. from the ``date`` Django template tag.
  418. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  419. precedence and will be applied instead.
  420. See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  421. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  422. .. setting:: DATETIME_FORMAT
  423. DATETIME_FORMAT
  424. ---------------
  425. Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
  426. The default formatting to use for displaying datetime fields in any part of the
  427. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  428. locale-dictated format has higher precedence and will be applied instead. See
  429. :tfilter:`allowed date format strings <date>`.
  430. See also :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  431. .. setting:: DATETIME_INPUT_FORMATS
  432. DATETIME_INPUT_FORMATS
  433. ----------------------
  434. Default::
  435. ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
  436. '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
  437. '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
  438. A tuple of formats that will be accepted when inputting data on a datetime
  439. field. Formats will be tried in order, using the first valid one. Note that
  440. these format strings use Python's datetime_ module syntax, not the format
  441. strings from the ``date`` Django template tag.
  442. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  443. precedence and will be applied instead.
  444. See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  445. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  446. .. setting:: DEBUG
  447. DEBUG
  448. -----
  449. Default: ``False``
  450. A boolean that turns on/off debug mode.
  451. Never deploy a site into production with :setting:`DEBUG` turned on.
  452. Did you catch that? NEVER deploy a site into production with :setting:`DEBUG`
  453. turned on.
  454. One of the main features of debug mode is the display of detailed error pages.
  455. If your app raises an exception when :setting:`DEBUG` is ``True``, Django will
  456. display a detailed traceback, including a lot of metadata about your
  457. environment, such as all the currently defined Django settings (from
  458. ``settings.py``).
  459. As a security measure, Django will *not* include settings that might be
  460. sensitive (or offensive), such as :setting:`SECRET_KEY` or
  461. :setting:`PROFANITIES_LIST`. Specifically, it will exclude any setting whose
  462. name includes any of the following:
  463. * ``'API'``
  464. * ``'KEY'``
  465. * ``'PASS'``
  466. * ``'PROFANITIES_LIST'``
  467. * ``'SECRET'``
  468. * ``'SIGNATURE'``
  469. * ``'TOKEN'``
  470. Note that these are *partial* matches. ``'PASS'`` will also match PASSWORD,
  471. just as ``'TOKEN'`` will also match TOKENIZED and so on.
  472. Still, note that there are always going to be sections of your debug output
  473. that are inappropriate for public consumption. File paths, configuration
  474. options and the like all give attackers extra information about your server.
  475. It is also important to remember that when running with :setting:`DEBUG`
  476. turned on, Django will remember every SQL query it executes. This is useful
  477. when you're debugging, but it'll rapidly consume memory on a production server.
  478. .. _django/views/debug.py: https://github.com/django/django/blob/master/django/views/debug.py
  479. .. setting:: DEBUG_PROPAGATE_EXCEPTIONS
  480. DEBUG_PROPAGATE_EXCEPTIONS
  481. --------------------------
  482. Default: ``False``
  483. If set to True, Django's normal exception handling of view functions
  484. will be suppressed, and exceptions will propagate upwards. This can
  485. be useful for some test setups, and should never be used on a live
  486. site.
  487. .. setting:: DECIMAL_SEPARATOR
  488. DECIMAL_SEPARATOR
  489. -----------------
  490. Default: ``'.'`` (Dot)
  491. Default decimal separator used when formatting decimal numbers.
  492. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  493. format has higher precedence and will be applied instead.
  494. See also :setting:`NUMBER_GROUPING`, :setting:`THOUSAND_SEPARATOR` and
  495. :setting:`USE_THOUSAND_SEPARATOR`.
  496. .. setting:: DEFAULT_CHARSET
  497. DEFAULT_CHARSET
  498. ---------------
  499. Default: ``'utf-8'``
  500. Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
  501. manually specified. Used with :setting:`DEFAULT_CONTENT_TYPE` to construct the
  502. ``Content-Type`` header.
  503. .. setting:: DEFAULT_CONTENT_TYPE
  504. DEFAULT_CONTENT_TYPE
  505. --------------------
  506. Default: ``'text/html'``
  507. Default content type to use for all ``HttpResponse`` objects, if a MIME type
  508. isn't manually specified. Used with :setting:`DEFAULT_CHARSET` to construct
  509. the ``Content-Type`` header.
  510. .. setting:: DEFAULT_EXCEPTION_REPORTER_FILTER
  511. DEFAULT_EXCEPTION_REPORTER_FILTER
  512. ---------------------------------
  513. Default: :class:`django.views.debug.SafeExceptionReporterFilter`
  514. Default exception reporter filter class to be used if none has been assigned to
  515. the :class:`~django.http.HttpRequest` instance yet.
  516. See :ref:`Filtering error reports<filtering-error-reports>`.
  517. .. setting:: DEFAULT_FILE_STORAGE
  518. DEFAULT_FILE_STORAGE
  519. --------------------
  520. Default: :class:`django.core.files.storage.FileSystemStorage`
  521. Default file storage class to be used for any file-related operations that don't
  522. specify a particular storage system. See :doc:`/topics/files`.
  523. .. setting:: DEFAULT_FROM_EMAIL
  524. DEFAULT_FROM_EMAIL
  525. ------------------
  526. Default: ``'webmaster@localhost'``
  527. Default email address to use for various automated correspondence from the
  528. site manager(s).
  529. .. setting:: DEFAULT_INDEX_TABLESPACE
  530. DEFAULT_INDEX_TABLESPACE
  531. ------------------------
  532. Default: ``''`` (Empty string)
  533. Default tablespace to use for indexes on fields that don't specify
  534. one, if the backend supports it (see :doc:`/topics/db/tablespaces`).
  535. .. setting:: DEFAULT_TABLESPACE
  536. DEFAULT_TABLESPACE
  537. ------------------
  538. Default: ``''`` (Empty string)
  539. Default tablespace to use for models that don't specify one, if the
  540. backend supports it (see :doc:`/topics/db/tablespaces`).
  541. .. setting:: DISALLOWED_USER_AGENTS
  542. DISALLOWED_USER_AGENTS
  543. ----------------------
  544. Default: ``()`` (Empty tuple)
  545. List of compiled regular expression objects representing User-Agent strings that
  546. are not allowed to visit any page, systemwide. Use this for bad robots/crawlers.
  547. This is only used if ``CommonMiddleware`` is installed (see
  548. :doc:`/topics/http/middleware`).
  549. .. setting:: EMAIL_BACKEND
  550. EMAIL_BACKEND
  551. -------------
  552. Default: ``'django.core.mail.backends.smtp.EmailBackend'``
  553. The backend to use for sending emails. For the list of available backends see
  554. :doc:`/topics/email`.
  555. .. setting:: EMAIL_FILE_PATH
  556. EMAIL_FILE_PATH
  557. ---------------
  558. Default: Not defined
  559. The directory used by the ``file`` email backend to store output files.
  560. .. setting:: EMAIL_HOST
  561. EMAIL_HOST
  562. ----------
  563. Default: ``'localhost'``
  564. The host to use for sending email.
  565. See also :setting:`EMAIL_PORT`.
  566. .. setting:: EMAIL_HOST_PASSWORD
  567. EMAIL_HOST_PASSWORD
  568. -------------------
  569. Default: ``''`` (Empty string)
  570. Password to use for the SMTP server defined in :setting:`EMAIL_HOST`. This
  571. setting is used in conjunction with :setting:`EMAIL_HOST_USER` when
  572. authenticating to the SMTP server. If either of these settings is empty,
  573. Django won't attempt authentication.
  574. See also :setting:`EMAIL_HOST_USER`.
  575. .. setting:: EMAIL_HOST_USER
  576. EMAIL_HOST_USER
  577. ---------------
  578. Default: ``''`` (Empty string)
  579. Username to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  580. If empty, Django won't attempt authentication.
  581. See also :setting:`EMAIL_HOST_PASSWORD`.
  582. .. setting:: EMAIL_PORT
  583. EMAIL_PORT
  584. ----------
  585. Default: ``25``
  586. Port to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  587. .. setting:: EMAIL_SUBJECT_PREFIX
  588. EMAIL_SUBJECT_PREFIX
  589. --------------------
  590. Default: ``'[Django] '``
  591. Subject-line prefix for email messages sent with ``django.core.mail.mail_admins``
  592. or ``django.core.mail.mail_managers``. You'll probably want to include the
  593. trailing space.
  594. .. setting:: EMAIL_USE_TLS
  595. EMAIL_USE_TLS
  596. -------------
  597. Default: ``False``
  598. Whether to use a TLS (secure) connection when talking to the SMTP server.
  599. .. setting:: FILE_CHARSET
  600. FILE_CHARSET
  601. ------------
  602. Default: ``'utf-8'``
  603. The character encoding used to decode any files read from disk. This includes
  604. template files and initial SQL data files.
  605. .. setting:: FILE_UPLOAD_HANDLERS
  606. FILE_UPLOAD_HANDLERS
  607. --------------------
  608. Default::
  609. ("django.core.files.uploadhandler.MemoryFileUploadHandler",
  610. "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
  611. A tuple of handlers to use for uploading. See :doc:`/topics/files` for details.
  612. .. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
  613. FILE_UPLOAD_MAX_MEMORY_SIZE
  614. ---------------------------
  615. Default: ``2621440`` (i.e. 2.5 MB).
  616. The maximum size (in bytes) that an upload will be before it gets streamed to
  617. the file system. See :doc:`/topics/files` for details.
  618. .. setting:: FILE_UPLOAD_PERMISSIONS
  619. FILE_UPLOAD_PERMISSIONS
  620. -----------------------
  621. Default: ``None``
  622. The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
  623. more information about what these modes mean, see the documentation for
  624. :func:`os.chmod`.
  625. If this isn't given or is ``None``, you'll get operating-system
  626. dependent behavior. On most platforms, temporary files will have a mode
  627. of ``0600``, and files saved from memory will be saved using the
  628. system's standard umask.
  629. .. warning::
  630. **Always prefix the mode with a 0.**
  631. If you're not familiar with file modes, please note that the leading
  632. ``0`` is very important: it indicates an octal number, which is the
  633. way that modes must be specified. If you try to use ``644``, you'll
  634. get totally incorrect behavior.
  635. .. setting:: FILE_UPLOAD_TEMP_DIR
  636. FILE_UPLOAD_TEMP_DIR
  637. --------------------
  638. Default: ``None``
  639. The directory to store data temporarily while uploading files. If ``None``,
  640. Django will use the standard temporary directory for the operating system. For
  641. example, this will default to '/tmp' on \*nix-style operating systems.
  642. See :doc:`/topics/files` for details.
  643. .. setting:: FIRST_DAY_OF_WEEK
  644. FIRST_DAY_OF_WEEK
  645. -----------------
  646. Default: ``0`` (Sunday)
  647. Number representing the first day of the week. This is especially useful
  648. when displaying a calendar. This value is only used when not using
  649. format internationalization, or when a format cannot be found for the
  650. current locale.
  651. The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
  652. Monday and so on.
  653. .. setting:: FIXTURE_DIRS
  654. FIXTURE_DIRS
  655. -------------
  656. Default: ``()`` (Empty tuple)
  657. List of directories searched for fixture files, in addition to the
  658. ``fixtures`` directory of each application, in search order.
  659. Note that these paths should use Unix-style forward slashes, even on Windows.
  660. See :ref:`initial-data-via-fixtures` and :ref:`topics-testing-fixtures`.
  661. .. setting:: FORCE_SCRIPT_NAME
  662. FORCE_SCRIPT_NAME
  663. ------------------
  664. Default: ``None``
  665. If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
  666. environment variable in any HTTP request. This setting can be used to override
  667. the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
  668. of the preferred value or not supplied at all.
  669. .. setting:: FORMAT_MODULE_PATH
  670. FORMAT_MODULE_PATH
  671. ------------------
  672. Default: ``None``
  673. A full Python path to a Python package that contains format definitions for
  674. project locales. If not ``None``, Django will check for a ``formats.py``
  675. file, under the directory named as the current locale, and will use the
  676. formats defined on this file.
  677. For example, if :setting:`FORMAT_MODULE_PATH` is set to ``mysite.formats``,
  678. and current language is ``en`` (English), Django will expect a directory tree
  679. like::
  680. mysite/
  681. formats/
  682. __init__.py
  683. en/
  684. __init__.py
  685. formats.py
  686. Available formats are :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT`,
  687. :setting:`DATETIME_FORMAT`, :setting:`YEAR_MONTH_FORMAT`,
  688. :setting:`MONTH_DAY_FORMAT`, :setting:`SHORT_DATE_FORMAT`,
  689. :setting:`SHORT_DATETIME_FORMAT`, :setting:`FIRST_DAY_OF_WEEK`,
  690. :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  691. :setting:`NUMBER_GROUPING`.
  692. .. setting:: IGNORABLE_404_URLS
  693. IGNORABLE_404_URLS
  694. ------------------
  695. Default: ``()``
  696. List of compiled regular expression objects describing URLs that should be
  697. ignored when reporting HTTP 404 errors via email (see
  698. :doc:`/howto/error-reporting`). Regular expressions are matched against
  699. :meth:`request's full paths <django.http.HttpRequest.get_full_path>` (including
  700. query string, if any). Use this if your site does not provide a commonly
  701. requested file such as ``favicon.ico`` or ``robots.txt``, or if it gets
  702. hammered by script kiddies.
  703. This is only used if
  704. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled (see
  705. :doc:`/topics/http/middleware`).
  706. .. setting:: INSTALLED_APPS
  707. INSTALLED_APPS
  708. --------------
  709. Default: ``()`` (Empty tuple)
  710. A tuple of strings designating all applications that are enabled in this Django
  711. installation. Each string should be a full Python path to a Python package that
  712. contains a Django application, as created by :djadmin:`django-admin.py startapp
  713. <startapp>`.
  714. .. admonition:: App names must be unique
  715. The application names (that is, the final dotted part of the
  716. path to the module containing ``models.py``) defined in
  717. :setting:`INSTALLED_APPS` *must* be unique. For example, you can't
  718. include both ``django.contrib.auth`` and ``myproject.auth`` in
  719. INSTALLED_APPS.
  720. .. setting:: INTERNAL_IPS
  721. INTERNAL_IPS
  722. ------------
  723. Default: ``()`` (Empty tuple)
  724. A tuple of IP addresses, as strings, that:
  725. * See debug comments, when :setting:`DEBUG` is ``True``
  726. * Receive X headers if the ``XViewMiddleware`` is installed (see
  727. :doc:`/topics/http/middleware`)
  728. .. setting:: LANGUAGE_CODE
  729. LANGUAGE_CODE
  730. -------------
  731. Default: ``'en-us'``
  732. A string representing the language code for this installation. This should be
  733. in standard :term:`language format<language code>`. For example, U.S. English
  734. is ``"en-us"``. See also the `list of language identifiers`_ and
  735. :doc:`/topics/i18n/index`.
  736. .. _list of language identifiers: http://www.i18nguy.com/unicode/language-identifiers.html
  737. .. setting:: LANGUAGE_COOKIE_NAME
  738. LANGUAGE_COOKIE_NAME
  739. --------------------
  740. Default: ``'django_language'``
  741. The name of the cookie to use for the language cookie. This can be whatever
  742. you want (but should be different from :setting:`SESSION_COOKIE_NAME`). See
  743. :doc:`/topics/i18n/index`.
  744. .. setting:: LANGUAGES
  745. LANGUAGES
  746. ---------
  747. Default: A tuple of all available languages. This list is continually growing
  748. and including a copy here would inevitably become rapidly out of date. You can
  749. see the current list of translated languages by looking in
  750. ``django/conf/global_settings.py`` (or view the `online source`_).
  751. .. _online source: https://github.com/django/django/blob/master/django/conf/global_settings.py
  752. The list is a tuple of two-tuples in the format ``(language code, language
  753. name)``, the ``language code`` part should be a
  754. :term:`language name<language code>` -- for example, ``('ja', 'Japanese')``.
  755. This specifies which languages are available for language selection. See
  756. :doc:`/topics/i18n/index`.
  757. Generally, the default value should suffice. Only set this setting if you want
  758. to restrict language selection to a subset of the Django-provided languages.
  759. If you define a custom :setting:`LANGUAGES` setting, it's OK to mark the
  760. languages as translation strings (as in the default value referred to above)
  761. -- but use a "dummy" ``gettext()`` function, not the one in
  762. ``django.utils.translation``. You should *never* import
  763. ``django.utils.translation`` from within your settings file, because that
  764. module in itself depends on the settings, and that would cause a circular
  765. import.
  766. The solution is to use a "dummy" ``gettext()`` function. Here's a sample
  767. settings file::
  768. gettext = lambda s: s
  769. LANGUAGES = (
  770. ('de', gettext('German')),
  771. ('en', gettext('English')),
  772. )
  773. With this arrangement, ``django-admin.py makemessages`` will still find and
  774. mark these strings for translation, but the translation won't happen at
  775. runtime -- so you'll have to remember to wrap the languages in the *real*
  776. ``gettext()`` in any code that uses :setting:`LANGUAGES` at runtime.
  777. .. setting:: LOCALE_PATHS
  778. LOCALE_PATHS
  779. ------------
  780. Default: ``()`` (Empty tuple)
  781. A tuple of directories where Django looks for translation files.
  782. See :ref:`how-django-discovers-translations`.
  783. Example::
  784. LOCALE_PATHS = (
  785. '/home/www/project/common_files/locale',
  786. '/var/local/translations/locale'
  787. )
  788. Django will look within each of these paths for the ``<locale_code>/LC_MESSAGES``
  789. directories containing the actual translation files.
  790. .. setting:: LOGGING
  791. LOGGING
  792. -------
  793. Default: A logging configuration dictionary.
  794. A data structure containing configuration information. The contents of
  795. this data structure will be passed as the argument to the
  796. configuration method described in :setting:`LOGGING_CONFIG`.
  797. The default logging configuration passes HTTP 500 server errors to an
  798. email log handler; all other log messages are given to a NullHandler.
  799. .. setting:: LOGGING_CONFIG
  800. LOGGING_CONFIG
  801. --------------
  802. Default: ``'django.utils.log.dictConfig'``
  803. A path to a callable that will be used to configure logging in the
  804. Django project. Points at a instance of Python's `dictConfig`_
  805. configuration method by default.
  806. If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
  807. configuration process will be skipped.
  808. .. _dictConfig: http://docs.python.org/library/logging.config.html#configuration-dictionary-schema
  809. .. setting:: MANAGERS
  810. MANAGERS
  811. --------
  812. Default: ``()`` (Empty tuple)
  813. A tuple in the same format as :setting:`ADMINS` that specifies who should get
  814. broken link notifications when
  815. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled.
  816. .. setting:: MEDIA_ROOT
  817. MEDIA_ROOT
  818. ----------
  819. Default: ``''`` (Empty string)
  820. Absolute filesystem path to the directory that will hold :doc:`user-uploaded
  821. files </topics/files>`.
  822. Example: ``"/var/www/example.com/media/"``
  823. See also :setting:`MEDIA_URL`.
  824. .. setting:: MEDIA_URL
  825. MEDIA_URL
  826. ---------
  827. Default: ``''`` (Empty string)
  828. URL that handles the media served from :setting:`MEDIA_ROOT`, used
  829. for :doc:`managing stored files </topics/files>`. It must end in a slash if set
  830. to a non-empty value.
  831. Example: ``"http://media.example.com/"``
  832. .. setting:: MIDDLEWARE_CLASSES
  833. MIDDLEWARE_CLASSES
  834. ------------------
  835. Default::
  836. ('django.middleware.common.CommonMiddleware',
  837. 'django.contrib.sessions.middleware.SessionMiddleware',
  838. 'django.middleware.csrf.CsrfViewMiddleware',
  839. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  840. 'django.contrib.messages.middleware.MessageMiddleware',)
  841. A tuple of middleware classes to use. See :doc:`/topics/http/middleware`.
  842. .. setting:: MONTH_DAY_FORMAT
  843. MONTH_DAY_FORMAT
  844. ----------------
  845. Default: ``'F j'``
  846. The default formatting to use for date fields on Django admin change-list
  847. pages -- and, possibly, by other parts of the system -- in cases when only the
  848. month and day are displayed.
  849. For example, when a Django admin change-list page is being filtered by a date
  850. drilldown, the header for a given day displays the day and month. Different
  851. locales have different formats. For example, U.S. English would say
  852. "January 1," whereas Spanish might say "1 Enero."
  853. See :tfilter:`allowed date format strings <date>`. See also
  854. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`,
  855. :setting:`TIME_FORMAT` and :setting:`YEAR_MONTH_FORMAT`.
  856. .. setting:: NUMBER_GROUPING
  857. NUMBER_GROUPING
  858. ----------------
  859. Default: ``0``
  860. Number of digits grouped together on the integer part of a number.
  861. Common use is to display a thousand separator. If this setting is ``0``, then
  862. no grouping will be applied to the number. If this setting is greater than
  863. ``0``, then :setting:`THOUSAND_SEPARATOR` will be used as the separator between
  864. those groups.
  865. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  866. format has higher precedence and will be applied instead.
  867. See also :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  868. :setting:`USE_THOUSAND_SEPARATOR`.
  869. .. setting:: PREPEND_WWW
  870. PREPEND_WWW
  871. -----------
  872. Default: ``False``
  873. Whether to prepend the "www." subdomain to URLs that don't have it. This is only
  874. used if :class:`~django.middleware.common.CommonMiddleware` is installed
  875. (see :doc:`/topics/http/middleware`). See also :setting:`APPEND_SLASH`.
  876. .. setting:: ROOT_URLCONF
  877. ROOT_URLCONF
  878. ------------
  879. Default: Not defined
  880. A string representing the full Python import path to your root URLconf. For example:
  881. ``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
  882. setting the attribute ``urlconf`` on the incoming ``HttpRequest``
  883. object. See :ref:`how-django-processes-a-request` for details.
  884. .. setting:: SECRET_KEY
  885. SECRET_KEY
  886. ----------
  887. Default: ``''`` (Empty string)
  888. A secret key for a particular Django installation. This is used to provide
  889. :doc:`cryptographic signing </topics/signing>`, and should be set to a unique,
  890. unpredictable value.
  891. :djadmin:`django-admin.py startproject <startproject>` automatically adds a
  892. randomly-generated ``SECRET_KEY`` to each new project.
  893. .. warning::
  894. **Keep this value secret.**
  895. Running Django with a known :setting:`SECRET_KEY` defeats many of Django's
  896. security protections, and can lead to privilege escalation and remote code
  897. execution vulnerabilities.
  898. .. versionchanged:: 1.5
  899. Django will now refuse to start if :setting:`SECRET_KEY` is not set.
  900. .. setting:: SECURE_PROXY_SSL_HEADER
  901. SECURE_PROXY_SSL_HEADER
  902. -----------------------
  903. Default: ``None``
  904. A tuple representing a HTTP header/value combination that signifies a request
  905. is secure. This controls the behavior of the request object's ``is_secure()``
  906. method.
  907. This takes some explanation. By default, ``is_secure()`` is able to determine
  908. whether a request is secure by looking at whether the requested URL uses
  909. "https://". This is important for Django's CSRF protection, and may be used
  910. by your own code or third-party apps.
  911. If your Django app is behind a proxy, though, the proxy may be "swallowing" the
  912. fact that a request is HTTPS, using a non-HTTPS connection between the proxy
  913. and Django. In this case, ``is_secure()`` would always return ``False`` -- even
  914. for requests that were made via HTTPS by the end user.
  915. In this situation, you'll want to configure your proxy to set a custom HTTP
  916. header that tells Django whether the request came in via HTTPS, and you'll want
  917. to set ``SECURE_PROXY_SSL_HEADER`` so that Django knows what header to look
  918. for.
  919. You'll need to set a tuple with two elements -- the name of the header to look
  920. for and the required value. For example::
  921. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  922. Here, we're telling Django that we trust the ``X-Forwarded-Proto`` header
  923. that comes from our proxy, and any time its value is ``'https'``, then the
  924. request is guaranteed to be secure (i.e., it originally came in via HTTPS).
  925. Obviously, you should *only* set this setting if you control your proxy or
  926. have some other guarantee that it sets/strips this header appropriately.
  927. Note that the header needs to be in the format as used by ``request.META`` --
  928. all caps and likely starting with ``HTTP_``. (Remember, Django automatically
  929. adds ``'HTTP_'`` to the start of x-header names before making the header
  930. available in ``request.META``.)
  931. .. warning::
  932. **You will probably open security holes in your site if you set this
  933. without knowing what you're doing. And if you fail to set it when you
  934. should. Seriously.**
  935. Make sure ALL of the following are true before setting this (assuming the
  936. values from the example above):
  937. * Your Django app is behind a proxy.
  938. * Your proxy strips the ``X-Forwarded-Proto`` header from all incoming
  939. requests. In other words, if end users include that header in their
  940. requests, the proxy will discard it.
  941. * Your proxy sets the ``X-Forwarded-Proto`` header and sends it to Django,
  942. but only for requests that originally come in via HTTPS.
  943. If any of those are not true, you should keep this setting set to ``None``
  944. and find another way of determining HTTPS, perhaps via custom middleware.
  945. .. setting:: SEND_BROKEN_LINK_EMAILS
  946. SEND_BROKEN_LINK_EMAILS
  947. -----------------------
  948. .. deprecated:: 1.6
  949. Since :class:`~django.middleware.common.BrokenLinkEmailsMiddleware`
  950. was split from :class:`~django.middleware.common.CommonMiddleware`,
  951. this setting no longer serves a purpose.
  952. Default: ``False``
  953. Whether to send an email to the :setting:`MANAGERS` each time somebody visits
  954. a Django-powered page that is 404ed with a non-empty referer (i.e., a broken
  955. link). This is only used if ``CommonMiddleware`` is installed (see
  956. :doc:`/topics/http/middleware`). See also :setting:`IGNORABLE_404_URLS` and
  957. :doc:`/howto/error-reporting`.
  958. .. setting:: SERIALIZATION_MODULES
  959. SERIALIZATION_MODULES
  960. ---------------------
  961. Default: Not defined.
  962. A dictionary of modules containing serializer definitions (provided as
  963. strings), keyed by a string identifier for that serialization type. For
  964. example, to define a YAML serializer, use::
  965. SERIALIZATION_MODULES = { 'yaml' : 'path.to.yaml_serializer' }
  966. .. setting:: SERVER_EMAIL
  967. SERVER_EMAIL
  968. ------------
  969. Default: ``'root@localhost'``
  970. The email address that error messages come from, such as those sent to
  971. :setting:`ADMINS` and :setting:`MANAGERS`.
  972. .. setting:: SHORT_DATE_FORMAT
  973. SHORT_DATE_FORMAT
  974. -----------------
  975. Default: ``m/d/Y`` (e.g. ``12/31/2003``)
  976. An available formatting that can be used for displaying date fields on
  977. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  978. corresponding locale-dictated format has higher precedence and will be applied.
  979. See :tfilter:`allowed date format strings <date>`.
  980. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  981. .. setting:: SHORT_DATETIME_FORMAT
  982. SHORT_DATETIME_FORMAT
  983. ---------------------
  984. Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
  985. An available formatting that can be used for displaying datetime fields on
  986. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  987. corresponding locale-dictated format has higher precedence and will be applied.
  988. See :tfilter:`allowed date format strings <date>`.
  989. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  990. .. setting:: SIGNING_BACKEND
  991. SIGNING_BACKEND
  992. ---------------
  993. Default: 'django.core.signing.TimestampSigner'
  994. The backend used for signing cookies and other data.
  995. See also the :doc:`/topics/signing` documentation.
  996. .. setting:: TEMPLATE_CONTEXT_PROCESSORS
  997. TEMPLATE_CONTEXT_PROCESSORS
  998. ---------------------------
  999. Default::
  1000. ("django.contrib.auth.context_processors.auth",
  1001. "django.core.context_processors.debug",
  1002. "django.core.context_processors.i18n",
  1003. "django.core.context_processors.media",
  1004. "django.core.context_processors.static",
  1005. "django.core.context_processors.tz",
  1006. "django.contrib.messages.context_processors.messages")
  1007. A tuple of callables that are used to populate the context in ``RequestContext``.
  1008. These callables take a request object as their argument and return a dictionary
  1009. of items to be merged into the context.
  1010. .. setting:: TEMPLATE_DEBUG
  1011. TEMPLATE_DEBUG
  1012. --------------
  1013. Default: ``False``
  1014. A boolean that turns on/off template debug mode. If this is ``True``, the fancy
  1015. error page will display a detailed report for any exception raised during
  1016. template rendering. This report contains the relevant snippet of the template,
  1017. with the appropriate line highlighted.
  1018. Note that Django only displays fancy error pages if :setting:`DEBUG` is ``True``, so
  1019. you'll want to set that to take advantage of this setting.
  1020. See also :setting:`DEBUG`.
  1021. .. setting:: TEMPLATE_DIRS
  1022. TEMPLATE_DIRS
  1023. -------------
  1024. Default: ``()`` (Empty tuple)
  1025. List of locations of the template source files searched by
  1026. :class:`django.template.loaders.filesystem.Loader`, in search order.
  1027. Note that these paths should use Unix-style forward slashes, even on Windows.
  1028. See :doc:`/topics/templates`.
  1029. .. setting:: TEMPLATE_LOADERS
  1030. TEMPLATE_LOADERS
  1031. ----------------
  1032. Default::
  1033. ('django.template.loaders.filesystem.Loader',
  1034. 'django.template.loaders.app_directories.Loader')
  1035. A tuple of template loader classes, specified as strings. Each ``Loader`` class
  1036. knows how to import templates from a particular source. Optionally, a tuple can be
  1037. used instead of a string. The first item in the tuple should be the ``Loader``'s
  1038. module, subsequent items are passed to the ``Loader`` during initialization. See
  1039. :doc:`/ref/templates/api`.
  1040. .. setting:: TEMPLATE_STRING_IF_INVALID
  1041. TEMPLATE_STRING_IF_INVALID
  1042. --------------------------
  1043. Default: ``''`` (Empty string)
  1044. Output, as a string, that the template system should use for invalid (e.g.
  1045. misspelled) variables. See :ref:`invalid-template-variables`..
  1046. .. setting:: TEST_RUNNER
  1047. TEST_RUNNER
  1048. -----------
  1049. Default: ``'django.test.simple.DjangoTestSuiteRunner'``
  1050. The name of the class to use for starting the test suite. See
  1051. :ref:`other-testing-frameworks`.
  1052. .. setting:: THOUSAND_SEPARATOR
  1053. THOUSAND_SEPARATOR
  1054. ------------------
  1055. Default: ``,`` (Comma)
  1056. Default thousand separator used when formatting numbers. This setting is
  1057. used only when :setting:`USE_THOUSAND_SEPARATOR` is ``True`` and
  1058. :setting:`NUMBER_GROUPING` is greater than ``0``.
  1059. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  1060. format has higher precedence and will be applied instead.
  1061. See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and
  1062. :setting:`USE_THOUSAND_SEPARATOR`.
  1063. .. setting:: TIME_FORMAT
  1064. TIME_FORMAT
  1065. -----------
  1066. Default: ``'P'`` (e.g. ``4 p.m.``)
  1067. The default formatting to use for displaying time fields in any part of the
  1068. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1069. locale-dictated format has higher precedence and will be applied instead. See
  1070. :tfilter:`allowed date format strings <date>`.
  1071. See also :setting:`DATE_FORMAT` and :setting:`DATETIME_FORMAT`.
  1072. .. setting:: TIME_INPUT_FORMATS
  1073. TIME_INPUT_FORMATS
  1074. ------------------
  1075. Default: ``('%H:%M:%S', '%H:%M')``
  1076. A tuple of formats that will be accepted when inputting data on a time field.
  1077. Formats will be tried in order, using the first valid one. Note that these
  1078. format strings use Python's datetime_ module syntax, not the format strings
  1079. from the ``date`` Django template tag.
  1080. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  1081. precedence and will be applied instead.
  1082. See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`.
  1083. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  1084. .. setting:: TIME_ZONE
  1085. TIME_ZONE
  1086. ---------
  1087. Default: ``'America/Chicago'``
  1088. A string representing the time zone for this installation, or ``None``. See
  1089. the `list of time zones`_.
  1090. Note that this isn't necessarily the time zone of the server. For example, one
  1091. server may serve multiple Django-powered sites, each with a separate time zone
  1092. setting.
  1093. When :setting:`USE_TZ` is ``False``, this is the time zone in which Django
  1094. will store all datetimes. When :setting:`USE_TZ` is ``True``, this is the
  1095. default time zone that Django will use to display datetimes in templates and
  1096. to interpret datetimes entered in forms.
  1097. Django sets the ``os.environ['TZ']`` variable to the time zone you specify in
  1098. the :setting:`TIME_ZONE` setting. Thus, all your views and models will
  1099. automatically operate in this time zone. However, Django won't set the ``TZ``
  1100. environment variable under the following conditions:
  1101. * If you're using the manual configuration option as described in
  1102. :ref:`manually configuring settings
  1103. <settings-without-django-settings-module>`, or
  1104. * If you specify ``TIME_ZONE = None``. This will cause Django to fall back to
  1105. using the system timezone. However, this is discouraged when :setting:`USE_TZ
  1106. = True <USE_TZ>`, because it makes conversions between local time and UTC
  1107. less reliable.
  1108. If Django doesn't set the ``TZ`` environment variable, it's up to you
  1109. to ensure your processes are running in the correct environment.
  1110. .. note::
  1111. Django cannot reliably use alternate time zones in a Windows environment.
  1112. If you're running Django on Windows, :setting:`TIME_ZONE` must be set to
  1113. match the system time zone.
  1114. .. _list of time zones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  1115. .. _pytz: http://pytz.sourceforge.net/
  1116. .. setting:: TRANSACTIONS_MANAGED
  1117. TRANSACTIONS_MANAGED
  1118. --------------------
  1119. Default: ``False``
  1120. Set this to ``True`` if you want to :ref:`disable Django's transaction
  1121. management <deactivate-transaction-management>` and implement your own.
  1122. .. setting:: USE_ETAGS
  1123. USE_ETAGS
  1124. ---------
  1125. Default: ``False``
  1126. A boolean that specifies whether to output the "Etag" header. This saves
  1127. bandwidth but slows down performance. This is used by the ``CommonMiddleware``
  1128. (see :doc:`/topics/http/middleware`) and in the``Cache Framework``
  1129. (see :doc:`/topics/cache`).
  1130. .. setting:: USE_I18N
  1131. USE_I18N
  1132. --------
  1133. Default: ``True``
  1134. A boolean that specifies whether Django's translation system should be enabled.
  1135. This provides an easy way to turn it off, for performance. If this is set to
  1136. ``False``, Django will make some optimizations so as not to load the
  1137. translation machinery.
  1138. See also :setting:`LANGUAGE_CODE`, :setting:`USE_L10N` and :setting:`USE_TZ`.
  1139. .. setting:: USE_L10N
  1140. USE_L10N
  1141. --------
  1142. Default: ``False``
  1143. A boolean that specifies if localized formatting of data will be enabled by
  1144. default or not. If this is set to ``True``, e.g. Django will display numbers and
  1145. dates using the format of the current locale.
  1146. See also :setting:`LANGUAGE_CODE`, :setting:`USE_I18N` and :setting:`USE_TZ`.
  1147. .. note::
  1148. The default :file:`settings.py` file created by :djadmin:`django-admin.py
  1149. startproject <startproject>` includes ``USE_L10N = True`` for convenience.
  1150. .. setting:: USE_THOUSAND_SEPARATOR
  1151. USE_THOUSAND_SEPARATOR
  1152. ----------------------
  1153. Default: ``False``
  1154. A boolean that specifies whether to display numbers using a thousand separator.
  1155. When :setting:`USE_L10N` is set to ``True`` and if this is also set to
  1156. ``True``, Django will use the values of :setting:`THOUSAND_SEPARATOR` and
  1157. :setting:`NUMBER_GROUPING` to format numbers.
  1158. See also :setting:`DECIMAL_SEPARATOR`, :setting:`NUMBER_GROUPING` and
  1159. :setting:`THOUSAND_SEPARATOR`.
  1160. .. setting:: USE_TZ
  1161. USE_TZ
  1162. ------
  1163. Default: ``False``
  1164. A boolean that specifies if datetimes will be timezone-aware by default or not.
  1165. If this is set to ``True``, Django will use timezone-aware datetimes internally.
  1166. Otherwise, Django will use naive datetimes in local time.
  1167. See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
  1168. .. note::
  1169. The default :file:`settings.py` file created by
  1170. :djadmin:`django-admin.py startproject <startproject>` includes
  1171. ``USE_TZ = True`` for convenience.
  1172. .. setting:: USE_X_FORWARDED_HOST
  1173. USE_X_FORWARDED_HOST
  1174. --------------------
  1175. Default: ``False``
  1176. A boolean that specifies whether to use the X-Forwarded-Host header in
  1177. preference to the Host header. This should only be enabled if a proxy
  1178. which sets this header is in use.
  1179. .. setting:: WSGI_APPLICATION
  1180. WSGI_APPLICATION
  1181. ----------------
  1182. Default: ``None``
  1183. The full Python path of the WSGI application object that Django's built-in
  1184. servers (e.g. :djadmin:`runserver`) will use. The :djadmin:`django-admin.py
  1185. startproject <startproject>` management command will create a simple
  1186. ``wsgi.py`` file with an ``application`` callable in it, and point this setting
  1187. to that ``application``.
  1188. If not set, the return value of ``django.core.wsgi.get_wsgi_application()``
  1189. will be used. In this case, the behavior of :djadmin:`runserver` will be
  1190. identical to previous Django versions.
  1191. .. setting:: YEAR_MONTH_FORMAT
  1192. YEAR_MONTH_FORMAT
  1193. -----------------
  1194. Default: ``'F Y'``
  1195. The default formatting to use for date fields on Django admin change-list
  1196. pages -- and, possibly, by other parts of the system -- in cases when only the
  1197. year and month are displayed.
  1198. For example, when a Django admin change-list page is being filtered by a date
  1199. drilldown, the header for a given month displays the month and the year.
  1200. Different locales have different formats. For example, U.S. English would say
  1201. "January 2006," whereas another locale might say "2006/January."
  1202. See :tfilter:`allowed date format strings <date>`. See also
  1203. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT`
  1204. and :setting:`MONTH_DAY_FORMAT`.
  1205. .. setting:: X_FRAME_OPTIONS
  1206. X_FRAME_OPTIONS
  1207. ---------------
  1208. Default: ``'SAMEORIGIN'``
  1209. The default value for the X-Frame-Options header used by
  1210. :class:`~django.middleware.clickjacking.XFrameOptionsMiddleware`. See the
  1211. :doc:`clickjacking protection </ref/clickjacking/>` documentation.
  1212. Admindocs
  1213. =========
  1214. Settings for :mod:`django.contrib.admindocs`.
  1215. .. setting:: ADMIN_FOR
  1216. ADMIN_FOR
  1217. ---------
  1218. Default: ``()`` (Empty tuple)
  1219. Used for admin-site settings modules, this should be a tuple of settings
  1220. modules (in the format ``'foo.bar.baz'``) for which this site is an admin.
  1221. The admin site uses this in its automatically-introspected documentation of
  1222. models, views and template tags.
  1223. Auth
  1224. ====
  1225. Settings for :mod:`django.contrib.auth`.
  1226. .. setting:: AUTHENTICATION_BACKENDS
  1227. AUTHENTICATION_BACKENDS
  1228. -----------------------
  1229. Default: ``('django.contrib.auth.backends.ModelBackend',)``
  1230. A tuple of authentication backend classes (as strings) to use when attempting to
  1231. authenticate a user. See the :ref:`authentication backends documentation
  1232. <authentication-backends>` for details.
  1233. .. setting:: AUTH_PROFILE_MODULE
  1234. AUTH_PROFILE_MODULE
  1235. -------------------
  1236. .. deprecated:: 1.5
  1237. With the introduction of :ref:`custom User models <auth-custom-user>`,
  1238. the use of :setting:`AUTH_PROFILE_MODULE` to define a single profile
  1239. model is no longer supported. See the
  1240. :doc:`Django 1.5 release notes</releases/1.5>` for more information.
  1241. Default: Not defined
  1242. The site-specific user profile model used by this site. See
  1243. :ref:`User profiles <auth-profiles>`.
  1244. .. setting:: AUTH_USER_MODEL
  1245. AUTH_USER_MODEL
  1246. ---------------
  1247. Default: 'auth.User'
  1248. The model to use to represent a User. See :ref:`auth-custom-user`.
  1249. .. setting:: LOGIN_REDIRECT_URL
  1250. LOGIN_REDIRECT_URL
  1251. ------------------
  1252. Default: ``'/accounts/profile/'``
  1253. The URL where requests are redirected after login when the
  1254. ``contrib.auth.login`` view gets no ``next`` parameter.
  1255. This is used by the :func:`~django.contrib.auth.decorators.login_required`
  1256. decorator, for example.
  1257. .. versionchanged:: 1.5
  1258. This setting now also accepts view function names and
  1259. :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
  1260. configuration duplication since you no longer have to define the URL in two
  1261. places (``settings`` and URLconf).
  1262. For backward compatibility reasons the default remains unchanged.
  1263. .. setting:: LOGIN_URL
  1264. LOGIN_URL
  1265. ---------
  1266. Default: ``'/accounts/login/'``
  1267. The URL where requests are redirected for login, especially when using the
  1268. :func:`~django.contrib.auth.decorators.login_required` decorator.
  1269. .. versionchanged:: 1.5
  1270. This setting now also accepts view function names and
  1271. :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
  1272. configuration duplication since you no longer have to define the URL in two
  1273. places (``settings`` and URLconf).
  1274. For backward compatibility reasons the default remains unchanged.
  1275. .. setting:: LOGOUT_URL
  1276. LOGOUT_URL
  1277. ----------
  1278. Default: ``'/accounts/logout/'``
  1279. LOGIN_URL counterpart.
  1280. .. setting:: PASSWORD_RESET_TIMEOUT_DAYS
  1281. PASSWORD_RESET_TIMEOUT_DAYS
  1282. ---------------------------
  1283. Default: ``3``
  1284. The number of days a password reset link is valid for. Used by the
  1285. :mod:`django.contrib.auth` password reset mechanism.
  1286. .. setting:: PASSWORD_HASHERS
  1287. PASSWORD_HASHERS
  1288. ----------------
  1289. See :ref:`auth_password_storage`.
  1290. Default::
  1291. ('django.contrib.auth.hashers.PBKDF2PasswordHasher',
  1292. 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
  1293. 'django.contrib.auth.hashers.BCryptPasswordHasher',
  1294. 'django.contrib.auth.hashers.SHA1PasswordHasher',
  1295. 'django.contrib.auth.hashers.MD5PasswordHasher',
  1296. 'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
  1297. 'django.contrib.auth.hashers.CryptPasswordHasher',)
  1298. .. _settings-comments:
  1299. Comments
  1300. ========
  1301. Settings for :mod:`django.contrib.comments`.
  1302. .. setting:: COMMENTS_HIDE_REMOVED
  1303. COMMENTS_HIDE_REMOVED
  1304. ---------------------
  1305. If ``True`` (default), removed comments will be excluded from comment
  1306. lists/counts (as taken from template tags). Otherwise, the template author is
  1307. responsible for some sort of a "this comment has been removed by the site staff"
  1308. message.
  1309. .. setting:: COMMENT_MAX_LENGTH
  1310. COMMENT_MAX_LENGTH
  1311. ------------------
  1312. The maximum length of the comment field, in characters. Comments longer than
  1313. this will be rejected. Defaults to 3000.
  1314. .. setting:: COMMENTS_APP
  1315. COMMENTS_APP
  1316. ------------
  1317. An app which provides :doc:`customization of the comments framework
  1318. </ref/contrib/comments/custom>`. Use the same dotted-string notation
  1319. as in :setting:`INSTALLED_APPS`. Your custom :setting:`COMMENTS_APP`
  1320. must also be listed in :setting:`INSTALLED_APPS`.
  1321. .. setting:: PROFANITIES_LIST
  1322. PROFANITIES_LIST
  1323. ----------------
  1324. Default: ``()`` (Empty tuple)
  1325. A tuple of profanities, as strings, that will be forbidden in comments when
  1326. ``COMMENTS_ALLOW_PROFANITIES`` is ``False``.
  1327. .. _settings-messages:
  1328. Messages
  1329. ========
  1330. Settings for :mod:`django.contrib.messages`.
  1331. .. setting:: MESSAGE_LEVEL
  1332. MESSAGE_LEVEL
  1333. -------------
  1334. Default: `messages.INFO`
  1335. Sets the minimum message level that will be recorded by the messages
  1336. framework. See :ref:`message levels <message-level>` for more details.
  1337. .. admonition:: Important
  1338. If you override ``MESSAGE_LEVEL`` in your settings file and rely on any of
  1339. the built-in constants, you must import the constants module directly to
  1340. avoid the potential for circular imports, e.g.::
  1341. from django.contrib.messages import constants as message_constants
  1342. MESSAGE_LEVEL = message_constants.DEBUG
  1343. If desired, you may specify the numeric values for the constants directly
  1344. according to the values in the above :ref:`constants table
  1345. <message-level-constants>`.
  1346. .. setting:: MESSAGE_STORAGE
  1347. MESSAGE_STORAGE
  1348. ---------------
  1349. Default: ``'django.contrib.messages.storage.fallback.FallbackStorage'``
  1350. Controls where Django stores message data. Valid values are:
  1351. * ``'django.contrib.messages.storage.fallback.FallbackStorage'``
  1352. * ``'django.contrib.messages.storage.session.SessionStorage'``
  1353. * ``'django.contrib.messages.storage.cookie.CookieStorage'``
  1354. See :ref:`message storage backends <message-storage-backends>` for more details.
  1355. .. setting:: MESSAGE_TAGS
  1356. MESSAGE_TAGS
  1357. ------------
  1358. Default::
  1359. {messages.DEBUG: 'debug',
  1360. messages.INFO: 'info',
  1361. messages.SUCCESS: 'success',
  1362. messages.WARNING: 'warning',
  1363. messages.ERROR: 'error',}
  1364. This sets the mapping of message level to message tag, which is typically
  1365. rendered as a CSS class in HTML. If you specify a value, it will extend
  1366. the default. This means you only have to specify those values which you need
  1367. to override. See :ref:`message-displaying` above for more details.
  1368. .. admonition:: Important
  1369. If you override ``MESSAGE_TAGS`` in your settings file and rely on any of
  1370. the built-in constants, you must import the ``constants`` module directly to
  1371. avoid the potential for circular imports, e.g.::
  1372. from django.contrib.messages import constants as message_constants
  1373. MESSAGE_TAGS = {message_constants.INFO: ''}
  1374. If desired, you may specify the numeric values for the constants directly
  1375. according to the values in the above :ref:`constants table
  1376. <message-level-constants>`.
  1377. .. _messages-session_cookie_domain:
  1378. SESSION_COOKIE_DOMAIN
  1379. ---------------------
  1380. Default: ``None``
  1381. The storage backends that use cookies -- ``CookieStorage`` and
  1382. ``FallbackStorage`` -- use the value of :setting:`SESSION_COOKIE_DOMAIN` in
  1383. setting their cookies.
  1384. .. _settings-sessions:
  1385. Sessions
  1386. ========
  1387. Settings for :mod:`django.contrib.sessions`.
  1388. .. setting:: SESSION_CACHE_ALIAS
  1389. SESSION_CACHE_ALIAS
  1390. -------------------
  1391. Default: ``default``
  1392. If you're using :ref:`cache-based session storage <cached-sessions-backend>`,
  1393. this selects the cache to use.
  1394. .. setting:: SESSION_COOKIE_AGE
  1395. SESSION_COOKIE_AGE
  1396. ------------------
  1397. Default: ``1209600`` (2 weeks, in seconds)
  1398. The age of session cookies, in seconds.
  1399. .. setting:: SESSION_COOKIE_DOMAIN
  1400. SESSION_COOKIE_DOMAIN
  1401. ---------------------
  1402. Default: ``None``
  1403. The domain to use for session cookies. Set this to a string such as
  1404. ``".example.com"`` (note the leading dot!) for cross-domain cookies, or use
  1405. ``None`` for a standard domain cookie.
  1406. .. setting:: SESSION_COOKIE_HTTPONLY
  1407. SESSION_COOKIE_HTTPONLY
  1408. -----------------------
  1409. Default: ``True``
  1410. Whether to use HTTPOnly flag on the session cookie. If this is set to
  1411. ``True``, client-side JavaScript will not to be able to access the
  1412. session cookie.
  1413. HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It
  1414. is not part of the :rfc:`2109` standard for cookies, and it isn't honored
  1415. consistently by all browsers. However, when it is honored, it can be a
  1416. useful way to mitigate the risk of client side script accessing the
  1417. protected cookie data.
  1418. .. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
  1419. .. setting:: SESSION_COOKIE_NAME
  1420. SESSION_COOKIE_NAME
  1421. -------------------
  1422. Default: ``'sessionid'``
  1423. The name of the cookie to use for sessions. This can be whatever you want (but
  1424. should be different from :setting:`LANGUAGE_COOKIE_NAME`).
  1425. .. setting:: SESSION_COOKIE_PATH
  1426. SESSION_COOKIE_PATH
  1427. -------------------
  1428. Default: ``'/'``
  1429. The path set on the session cookie. This should either match the URL path of your
  1430. Django installation or be parent of that path.
  1431. This is useful if you have multiple Django instances running under the same
  1432. hostname. They can use different cookie paths, and each instance will only see
  1433. its own session cookie.
  1434. .. setting:: SESSION_COOKIE_SECURE
  1435. SESSION_COOKIE_SECURE
  1436. ---------------------
  1437. Default: ``False``
  1438. Whether to use a secure cookie for the session cookie. If this is set to
  1439. ``True``, the cookie will be marked as "secure," which means browsers may
  1440. ensure that the cookie is only sent under an HTTPS connection.
  1441. .. setting:: SESSION_ENGINE
  1442. SESSION_ENGINE
  1443. --------------
  1444. Default: ``django.contrib.sessions.backends.db``
  1445. Controls where Django stores session data. Valid values are:
  1446. * ``'django.contrib.sessions.backends.db'``
  1447. * ``'django.contrib.sessions.backends.file'``
  1448. * ``'django.contrib.sessions.backends.cache'``
  1449. * ``'django.contrib.sessions.backends.cached_db'``
  1450. * ``'django.contrib.sessions.backends.signed_cookies'``
  1451. See :ref:`configuring-sessions` for more details.
  1452. .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
  1453. SESSION_EXPIRE_AT_BROWSER_CLOSE
  1454. -------------------------------
  1455. Default: ``False``
  1456. Whether to expire the session when the user closes his or her browser. See
  1457. "Browser-length sessions vs. persistent sessions" above.
  1458. .. setting:: SESSION_FILE_PATH
  1459. SESSION_FILE_PATH
  1460. -----------------
  1461. Default: ``None``
  1462. If you're using file-based session storage, this sets the directory in
  1463. which Django will store session data. When the default value (``None``) is
  1464. used, Django will use the standard temporary directory for the system.
  1465. .. setting:: SESSION_SAVE_EVERY_REQUEST
  1466. SESSION_SAVE_EVERY_REQUEST
  1467. --------------------------
  1468. Default: ``False``
  1469. Whether to save the session data on every request. If this is ``False``
  1470. (default), then the session data will only be saved if it has been modified --
  1471. that is, if any of its dictionary values have been assigned or deleted.
  1472. Sites
  1473. =====
  1474. Settings for :mod:`django.contrib.sites`.
  1475. .. setting:: SITE_ID
  1476. SITE_ID
  1477. -------
  1478. Default: Not defined
  1479. The ID, as an integer, of the current site in the ``django_site`` database
  1480. table. This is used so that application data can hook into specific sites
  1481. and a single database can manage content for multiple sites.
  1482. .. _settings-staticfiles:
  1483. Static files
  1484. ============
  1485. Settings for :mod:`django.contrib.staticfiles`.
  1486. .. setting:: STATIC_ROOT
  1487. STATIC_ROOT
  1488. -----------
  1489. Default: ``''`` (Empty string)
  1490. The absolute path to the directory where :djadmin:`collectstatic` will collect
  1491. static files for deployment.
  1492. Example: ``"/var/www/example.com/static/"``
  1493. If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
  1494. (default) the :djadmin:`collectstatic` management command will collect static
  1495. files into this directory. See the howto on :doc:`managing static
  1496. files</howto/static-files>` for more details about usage.
  1497. .. warning::
  1498. This should be an (initially empty) destination directory for collecting
  1499. your static files from their permanent locations into one directory for
  1500. ease of deployment; it is **not** a place to store your static files
  1501. permanently. You should do that in directories that will be found by
  1502. :doc:`staticfiles</ref/contrib/staticfiles>`'s
  1503. :setting:`finders<STATICFILES_FINDERS>`, which by default, are
  1504. ``'static/'`` app sub-directories and any directories you include in
  1505. :setting:`STATICFILES_DIRS`).
  1506. .. setting:: STATIC_URL
  1507. STATIC_URL
  1508. ----------
  1509. Default: ``None``
  1510. URL to use when referring to static files located in :setting:`STATIC_ROOT`.
  1511. Example: ``"/static/"`` or ``"http://static.example.com/"``
  1512. If not ``None``, this will be used as the base path for
  1513. :ref:`media definitions<form-media-paths>` and the
  1514. :doc:`staticfiles app</ref/contrib/staticfiles>`.
  1515. It must end in a slash if set to a non-empty value.
  1516. .. setting:: STATICFILES_DIRS
  1517. STATICFILES_DIRS
  1518. ----------------
  1519. Default: ``[]``
  1520. This setting defines the additional locations the staticfiles app will traverse
  1521. if the ``FileSystemFinder`` finder is enabled, e.g. if you use the
  1522. :djadmin:`collectstatic` or :djadmin:`findstatic` management command or use the
  1523. static file serving view.
  1524. This should be set to a list or tuple of strings that contain full paths to
  1525. your additional files directory(ies) e.g.::
  1526. STATICFILES_DIRS = (
  1527. "/home/special.polls.com/polls/static",
  1528. "/home/polls.com/polls/static",
  1529. "/opt/webfiles/common",
  1530. )
  1531. Prefixes (optional)
  1532. ~~~~~~~~~~~~~~~~~~~
  1533. In case you want to refer to files in one of the locations with an additional
  1534. namespace, you can **optionally** provide a prefix as ``(prefix, path)``
  1535. tuples, e.g.::
  1536. STATICFILES_DIRS = (
  1537. # ...
  1538. ("downloads", "/opt/webfiles/stats"),
  1539. )
  1540. Example:
  1541. Assuming you have :setting:`STATIC_URL` set ``'/static/'``, the
  1542. :djadmin:`collectstatic` management command would collect the "stats" files
  1543. in a ``'downloads'`` subdirectory of :setting:`STATIC_ROOT`.
  1544. This would allow you to refer to the local file
  1545. ``'/opt/webfiles/stats/polls_20101022.tar.gz'`` with
  1546. ``'/static/downloads/polls_20101022.tar.gz'`` in your templates, e.g.:
  1547. .. code-block:: html+django
  1548. <a href="{{ STATIC_URL }}downloads/polls_20101022.tar.gz">
  1549. .. setting:: STATICFILES_STORAGE
  1550. STATICFILES_STORAGE
  1551. -------------------
  1552. Default: ``'django.contrib.staticfiles.storage.StaticFilesStorage'``
  1553. The file storage engine to use when collecting static files with the
  1554. :djadmin:`collectstatic` management command.
  1555. A ready-to-use instance of the storage backend defined in this setting
  1556. can be found at ``django.contrib.staticfiles.storage.staticfiles_storage``.
  1557. For an example, see :ref:`staticfiles-from-cdn`.
  1558. .. setting:: STATICFILES_FINDERS
  1559. STATICFILES_FINDERS
  1560. -------------------
  1561. Default::
  1562. ("django.contrib.staticfiles.finders.FileSystemFinder",
  1563. "django.contrib.staticfiles.finders.AppDirectoriesFinder")
  1564. The list of finder backends that know how to find static files in
  1565. various locations.
  1566. The default will find files stored in the :setting:`STATICFILES_DIRS` setting
  1567. (using ``django.contrib.staticfiles.finders.FileSystemFinder``) and in a
  1568. ``static`` subdirectory of each app (using
  1569. ``django.contrib.staticfiles.finders.AppDirectoriesFinder``)
  1570. One finder is disabled by default:
  1571. ``django.contrib.staticfiles.finders.DefaultStorageFinder``. If added to
  1572. your :setting:`STATICFILES_FINDERS` setting, it will look for static files in
  1573. the default file storage as defined by the :setting:`DEFAULT_FILE_STORAGE`
  1574. setting.
  1575. .. note::
  1576. When using the ``AppDirectoriesFinder`` finder, make sure your apps
  1577. can be found by staticfiles. Simply add the app to the
  1578. :setting:`INSTALLED_APPS` setting of your site.
  1579. Static file finders are currently considered a private interface, and this
  1580. interface is thus undocumented.
  1581. Core Settings Topical Index
  1582. ===========================
  1583. Cache
  1584. -----
  1585. * :setting:`CACHES`
  1586. * :setting:`CACHE_MIDDLEWARE_ALIAS`
  1587. * :setting:`CACHE_MIDDLEWARE_ANONYMOUS_ONLY`
  1588. * :setting:`CACHE_MIDDLEWARE_KEY_PREFIX`
  1589. * :setting:`CACHE_MIDDLEWARE_SECONDS`
  1590. Database
  1591. --------
  1592. * :setting:`DATABASES`
  1593. * :setting:`DATABASE_ROUTERS`
  1594. * :setting:`DEFAULT_INDEX_TABLESPACE`
  1595. * :setting:`DEFAULT_TABLESPACE`
  1596. * :setting:`TRANSACTIONS_MANAGED`
  1597. Debugging
  1598. ---------
  1599. * :setting:`DEBUG`
  1600. * :setting:`DEBUG_PROPAGATE_EXCEPTIONS`
  1601. Email
  1602. -----
  1603. * :setting:`ADMINS`
  1604. * :setting:`DEFAULT_CHARSET`
  1605. * :setting:`DEFAULT_FROM_EMAIL`
  1606. * :setting:`EMAIL_BACKEND`
  1607. * :setting:`EMAIL_FILE_PATH`
  1608. * :setting:`EMAIL_HOST`
  1609. * :setting:`EMAIL_HOST_PASSWORD`
  1610. * :setting:`EMAIL_HOST_USER`
  1611. * :setting:`EMAIL_PORT`
  1612. * :setting:`EMAIL_SUBJECT_PREFIX`
  1613. * :setting:`EMAIL_USE_TLS`
  1614. * :setting:`MANAGERS`
  1615. * :setting:`SEND_BROKEN_LINK_EMAILS`
  1616. * :setting:`SERVER_EMAIL`
  1617. Error reporting
  1618. ---------------
  1619. * :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER`
  1620. * :setting:`IGNORABLE_404_URLS`
  1621. * :setting:`MANAGERS`
  1622. * :setting:`SEND_BROKEN_LINK_EMAILS`
  1623. File uploads
  1624. ------------
  1625. * :setting:`DEFAULT_FILE_STORAGE`
  1626. * :setting:`FILE_CHARSET`
  1627. * :setting:`FILE_UPLOAD_HANDLERS`
  1628. * :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`
  1629. * :setting:`FILE_UPLOAD_PERMISSIONS`
  1630. * :setting:`FILE_UPLOAD_TEMP_DIR`
  1631. * :setting:`MEDIA_ROOT`
  1632. * :setting:`MEDIA_URL`
  1633. Globalization (i18n/l10n)
  1634. -------------------------
  1635. * :setting:`DATE_FORMAT`
  1636. * :setting:`DATE_INPUT_FORMATS`
  1637. * :setting:`DATETIME_FORMAT`
  1638. * :setting:`DATETIME_INPUT_FORMATS`
  1639. * :setting:`DECIMAL_SEPARATOR`
  1640. * :setting:`FIRST_DAY_OF_WEEK`
  1641. * :setting:`FORMAT_MODULE_PATH`
  1642. * :setting:`LANGUAGE_CODE`
  1643. * :setting:`LANGUAGE_COOKIE_NAME`
  1644. * :setting:`LANGUAGES`
  1645. * :setting:`LOCALE_PATHS`
  1646. * :setting:`MONTH_DAY_FORMAT`
  1647. * :setting:`NUMBER_GROUPING`
  1648. * :setting:`SHORT_DATE_FORMAT`
  1649. * :setting:`SHORT_DATETIME_FORMAT`
  1650. * :setting:`THOUSAND_SEPARATOR`
  1651. * :setting:`TIME_FORMAT`
  1652. * :setting:`TIME_INPUT_FORMATS`
  1653. * :setting:`TIME_ZONE`
  1654. * :setting:`USE_I18N`
  1655. * :setting:`USE_L10N`
  1656. * :setting:`USE_THOUSAND_SEPARATOR`
  1657. * :setting:`USE_TZ`
  1658. * :setting:`YEAR_MONTH_FORMAT`
  1659. HTTP
  1660. ----
  1661. * :setting:`DEFAULT_CHARSET`
  1662. * :setting:`DEFAULT_CONTENT_TYPE`
  1663. * :setting:`DISALLOWED_USER_AGENTS`
  1664. * :setting:`FORCE_SCRIPT_NAME`
  1665. * :setting:`INTERNAL_IPS`
  1666. * :setting:`MIDDLEWARE_CLASSES`
  1667. * :setting:`SECURE_PROXY_SSL_HEADER`
  1668. * :setting:`SIGNING_BACKEND`
  1669. * :setting:`USE_ETAGS`
  1670. * :setting:`USE_X_FORWARDED_HOST`
  1671. * :setting:`WSGI_APPLICATION`
  1672. Logging
  1673. -------
  1674. * :setting:`LOGGING`
  1675. * :setting:`LOGGING_CONFIG`
  1676. Models
  1677. ------
  1678. * :setting:`ABSOLUTE_URL_OVERRIDES`
  1679. * :setting:`FIXTURE_DIRS`
  1680. * :setting:`INSTALLED_APPS`
  1681. Security
  1682. --------
  1683. * Cross Site Request Forgery protection
  1684. * :setting:`CSRF_COOKIE_DOMAIN`
  1685. * :setting:`CSRF_COOKIE_NAME`
  1686. * :setting:`CSRF_COOKIE_PATH`
  1687. * :setting:`CSRF_COOKIE_SECURE`
  1688. * :setting:`CSRF_FAILURE_VIEW`
  1689. * :setting:`SECRET_KEY`
  1690. * :setting:`X_FRAME_OPTIONS`
  1691. Serialization
  1692. -------------
  1693. * :setting:`DEFAULT_CHARSET`
  1694. * :setting:`SERIALIZATION_MODULES`
  1695. Templates
  1696. ---------
  1697. * :setting:`ALLOWED_INCLUDE_ROOTS`
  1698. * :setting:`TEMPLATE_CONTEXT_PROCESSORS`
  1699. * :setting:`TEMPLATE_DEBUG`
  1700. * :setting:`TEMPLATE_DIRS`
  1701. * :setting:`TEMPLATE_LOADERS`
  1702. * :setting:`TEMPLATE_STRING_IF_INVALID`
  1703. Testing
  1704. -------
  1705. * Database
  1706. * :setting:`TEST_CHARSET`
  1707. * :setting:`TEST_COLLATION`
  1708. * :setting:`TEST_DEPENDENCIES`
  1709. * :setting:`TEST_MIRROR`
  1710. * :setting:`TEST_NAME`
  1711. * :setting:`TEST_CREATE`
  1712. * :setting:`TEST_USER`
  1713. * :setting:`TEST_USER_CREATE`
  1714. * :setting:`TEST_PASSWD`
  1715. * :setting:`TEST_TBLSPACE`
  1716. * :setting:`TEST_TBLSPACE_TMP`
  1717. * :setting:`TEST_RUNNER`
  1718. URLs
  1719. ----
  1720. * :setting:`APPEND_SLASH`
  1721. * :setting:`PREPEND_WWW`
  1722. * :setting:`ROOT_URLCONF`