settings.txt 99 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252125312541255125612571258125912601261126212631264126512661267126812691270127112721273127412751276127712781279128012811282128312841285128612871288128912901291129212931294129512961297129812991300130113021303130413051306130713081309131013111312131313141315131613171318131913201321132213231324132513261327132813291330133113321333133413351336133713381339134013411342134313441345134613471348134913501351135213531354135513561357135813591360136113621363136413651366136713681369137013711372137313741375137613771378137913801381138213831384138513861387138813891390139113921393139413951396139713981399140014011402140314041405140614071408140914101411141214131414141514161417141814191420142114221423142414251426142714281429143014311432143314341435143614371438143914401441144214431444144514461447144814491450145114521453145414551456145714581459146014611462146314641465146614671468146914701471147214731474147514761477147814791480148114821483148414851486148714881489149014911492149314941495149614971498149915001501150215031504150515061507150815091510151115121513151415151516151715181519152015211522152315241525152615271528152915301531153215331534153515361537153815391540154115421543154415451546154715481549155015511552155315541555155615571558155915601561156215631564156515661567156815691570157115721573157415751576157715781579158015811582158315841585158615871588158915901591159215931594159515961597159815991600160116021603160416051606160716081609161016111612161316141615161616171618161916201621162216231624162516261627162816291630163116321633163416351636163716381639164016411642164316441645164616471648164916501651165216531654165516561657165816591660166116621663166416651666166716681669167016711672167316741675167616771678167916801681168216831684168516861687168816891690169116921693169416951696169716981699170017011702170317041705170617071708170917101711171217131714171517161717171817191720172117221723172417251726172717281729173017311732173317341735173617371738173917401741174217431744174517461747174817491750175117521753175417551756175717581759176017611762176317641765176617671768176917701771177217731774177517761777177817791780178117821783178417851786178717881789179017911792179317941795179617971798179918001801180218031804180518061807180818091810181118121813181418151816181718181819182018211822182318241825182618271828182918301831183218331834183518361837183818391840184118421843184418451846184718481849185018511852185318541855185618571858185918601861186218631864186518661867186818691870187118721873187418751876187718781879188018811882188318841885188618871888188918901891189218931894189518961897189818991900190119021903190419051906190719081909191019111912191319141915191619171918191919201921192219231924192519261927192819291930193119321933193419351936193719381939194019411942194319441945194619471948194919501951195219531954195519561957195819591960196119621963196419651966196719681969197019711972197319741975197619771978197919801981198219831984198519861987198819891990199119921993199419951996199719981999200020012002200320042005200620072008200920102011201220132014201520162017201820192020202120222023202420252026202720282029203020312032203320342035203620372038203920402041204220432044204520462047204820492050205120522053205420552056205720582059206020612062206320642065206620672068206920702071207220732074207520762077207820792080208120822083208420852086208720882089209020912092209320942095209620972098209921002101210221032104210521062107210821092110211121122113211421152116211721182119212021212122212321242125212621272128212921302131213221332134213521362137213821392140214121422143214421452146214721482149215021512152215321542155215621572158215921602161216221632164216521662167216821692170217121722173217421752176217721782179218021812182218321842185218621872188218921902191219221932194219521962197219821992200220122022203220422052206220722082209221022112212221322142215221622172218221922202221222222232224222522262227222822292230223122322233223422352236223722382239224022412242224322442245224622472248224922502251225222532254225522562257225822592260226122622263226422652266226722682269227022712272227322742275227622772278227922802281228222832284228522862287228822892290229122922293229422952296229722982299230023012302230323042305230623072308230923102311231223132314231523162317231823192320232123222323232423252326232723282329233023312332233323342335233623372338233923402341234223432344234523462347234823492350235123522353235423552356235723582359236023612362236323642365236623672368236923702371237223732374237523762377237823792380238123822383238423852386238723882389239023912392239323942395239623972398239924002401240224032404240524062407240824092410241124122413241424152416241724182419242024212422242324242425242624272428242924302431243224332434243524362437243824392440244124422443244424452446244724482449245024512452245324542455245624572458245924602461246224632464246524662467246824692470247124722473247424752476247724782479248024812482248324842485248624872488248924902491249224932494249524962497249824992500250125022503250425052506250725082509251025112512251325142515251625172518251925202521252225232524252525262527252825292530253125322533253425352536253725382539254025412542254325442545254625472548254925502551255225532554255525562557255825592560256125622563256425652566256725682569257025712572257325742575257625772578257925802581258225832584258525862587258825892590259125922593259425952596259725982599260026012602260326042605260626072608260926102611261226132614261526162617261826192620262126222623262426252626262726282629263026312632263326342635263626372638263926402641264226432644264526462647264826492650265126522653265426552656265726582659266026612662266326642665266626672668266926702671267226732674267526762677267826792680268126822683268426852686268726882689269026912692269326942695269626972698269927002701270227032704270527062707270827092710271127122713271427152716271727182719272027212722272327242725272627272728272927302731273227332734273527362737273827392740274127422743274427452746274727482749275027512752275327542755275627572758275927602761276227632764276527662767276827692770277127722773277427752776277727782779278027812782278327842785278627872788278927902791279227932794279527962797279827992800280128022803280428052806280728082809281028112812281328142815281628172818281928202821282228232824282528262827282828292830283128322833283428352836283728382839284028412842284328442845284628472848284928502851285228532854285528562857285828592860286128622863286428652866286728682869287028712872287328742875287628772878287928802881288228832884288528862887288828892890289128922893289428952896289728982899290029012902290329042905290629072908290929102911291229132914291529162917291829192920292129222923292429252926292729282929293029312932293329342935293629372938293929402941294229432944294529462947294829492950295129522953295429552956295729582959296029612962296329642965296629672968296929702971297229732974297529762977297829792980298129822983298429852986298729882989299029912992299329942995299629972998299930003001300230033004300530063007300830093010301130123013301430153016301730183019302030213022302330243025302630273028302930303031303230333034303530363037303830393040304130423043304430453046304730483049305030513052305330543055305630573058305930603061306230633064306530663067306830693070307130723073307430753076307730783079308030813082308330843085308630873088308930903091309230933094309530963097309830993100310131023103310431053106310731083109311031113112311331143115311631173118311931203121312231233124312531263127312831293130313131323133313431353136313731383139314031413142314331443145314631473148314931503151315231533154315531563157315831593160316131623163316431653166316731683169317031713172317331743175317631773178317931803181318231833184318531863187318831893190319131923193319431953196319731983199320032013202320332043205320632073208320932103211321232133214321532163217321832193220322132223223322432253226322732283229323032313232323332343235323632373238323932403241324232433244324532463247324832493250325132523253325432553256325732583259326032613262326332643265326632673268326932703271327232733274327532763277327832793280328132823283328432853286328732883289329032913292329332943295329632973298329933003301330233033304330533063307330833093310331133123313331433153316331733183319332033213322332333243325332633273328332933303331333233333334333533363337333833393340334133423343334433453346334733483349335033513352335333543355335633573358335933603361336233633364336533663367336833693370337133723373337433753376337733783379338033813382338333843385338633873388338933903391339233933394339533963397339833993400340134023403340434053406340734083409341034113412341334143415341634173418341934203421342234233424342534263427342834293430343134323433343434353436343734383439344034413442344334443445344634473448344934503451345234533454345534563457345834593460346134623463346434653466346734683469
  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:`STATICFILES_FINDERS`. Make sure you keep the components
  11. 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. For introductory material, see the :doc:`settings topic
  17. guide </topics/settings>`.
  18. .. setting:: ABSOLUTE_URL_OVERRIDES
  19. ABSOLUTE_URL_OVERRIDES
  20. ----------------------
  21. Default: ``{}`` (Empty dictionary)
  22. A dictionary mapping ``"app_label.model_name"`` strings to functions that take
  23. a model object and return its URL. This is a way of inserting or overriding
  24. ``get_absolute_url()`` methods on a per-installation basis. Example::
  25. ABSOLUTE_URL_OVERRIDES = {
  26. 'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
  27. 'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
  28. }
  29. Note that the model name used in this setting should be all lower-case, regardless
  30. of the case of the actual model class name.
  31. .. versionchanged:: 1.7.1
  32. ``ABSOLUTE_URL_OVERRIDES`` now works on models that don't declare
  33. ``get_absolute_url()``.
  34. .. setting:: ADMINS
  35. ADMINS
  36. ------
  37. Default: ``()`` (Empty tuple)
  38. A tuple that lists people who get code error notifications. When
  39. ``DEBUG=False`` and a view raises an exception, Django will email these people
  40. with the full exception information. Each member of the tuple should be a tuple
  41. of (Full name, email address). Example::
  42. (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
  43. Note that Django will email *all* of these people whenever an error happens.
  44. See :doc:`/howto/error-reporting` for more information.
  45. .. setting:: ALLOWED_HOSTS
  46. ALLOWED_HOSTS
  47. -------------
  48. Default: ``[]`` (Empty list)
  49. A list of strings representing the host/domain names that this Django site can
  50. serve. This is a security measure to prevent an attacker from poisoning caches
  51. and password reset emails with links to malicious hosts by submitting requests
  52. with a fake HTTP ``Host`` header, which is possible even under many
  53. seemingly-safe web server configurations.
  54. Values in this list can be fully qualified names (e.g. ``'www.example.com'``),
  55. in which case they will be matched against the request's ``Host`` header
  56. exactly (case-insensitive, not including port). A value beginning with a period
  57. can be used as a subdomain wildcard: ``'.example.com'`` will match
  58. ``example.com``, ``www.example.com``, and any other subdomain of
  59. ``example.com``. A value of ``'*'`` will match anything; in this case you are
  60. responsible to provide your own validation of the ``Host`` header (perhaps in a
  61. middleware; if so this middleware must be listed first in
  62. :setting:`MIDDLEWARE_CLASSES`).
  63. .. versionchanged:: 1.7
  64. In previous versions of Django, if you wanted to also allow the
  65. `fully qualified domain name (FQDN)`_, which some browsers can send in the
  66. ``Host`` header, you had to explicitly add another ``ALLOWED_HOSTS`` entry
  67. that included a trailing period. This entry could also be a subdomain
  68. wildcard::
  69. ALLOWED_HOSTS = [
  70. '.example.com', # Allow domain and subdomains
  71. '.example.com.', # Also allow FQDN and subdomains
  72. ]
  73. In Django 1.7, the trailing dot is stripped when performing host validation,
  74. thus an entry with a trailing dot isn't required.
  75. .. _`fully qualified domain name (FQDN)`: http://en.wikipedia.org/wiki/Fully_qualified_domain_name
  76. If the ``Host`` header (or ``X-Forwarded-Host`` if
  77. :setting:`USE_X_FORWARDED_HOST` is enabled) does not match any value in this
  78. list, the :meth:`django.http.HttpRequest.get_host()` method will raise
  79. :exc:`~django.core.exceptions.SuspiciousOperation`.
  80. When :setting:`DEBUG` is ``True`` or when running tests, host validation is
  81. disabled; any host will be accepted. Thus it's usually only necessary to set it
  82. in production.
  83. This validation only applies via :meth:`~django.http.HttpRequest.get_host()`;
  84. if your code accesses the ``Host`` header directly from ``request.META`` you
  85. are bypassing this security protection.
  86. .. setting:: ALLOWED_INCLUDE_ROOTS
  87. ALLOWED_INCLUDE_ROOTS
  88. ---------------------
  89. Default: ``()`` (Empty tuple)
  90. .. deprecated:: 1.8
  91. This setting, along with the :ttag:`ssi` template tag, is deprecated and
  92. will be removed in Django 2.0.
  93. .. versionchanged:: 1.8
  94. You can also set the ``'allowed_include_roots'`` option in the
  95. :setting:`OPTIONS <TEMPLATES-OPTIONS>` of a ``DjangoTemplates`` backend
  96. instead.
  97. A tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
  98. tag. This is a security measure, so that template authors can't access files
  99. that they shouldn't be accessing.
  100. For example, if :setting:`ALLOWED_INCLUDE_ROOTS` is ``('/home/html', '/var/www')``,
  101. then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
  102. wouldn't.
  103. .. setting:: APPEND_SLASH
  104. APPEND_SLASH
  105. ------------
  106. Default: ``True``
  107. When set to ``True``, if the request URL does not match any of the patterns
  108. in the URLconf and it doesn't end in a slash, an HTTP redirect is issued to the
  109. same URL with a slash appended. Note that the redirect may cause any data
  110. submitted in a POST request to be lost.
  111. The :setting:`APPEND_SLASH` setting is only used if
  112. :class:`~django.middleware.common.CommonMiddleware` is installed
  113. (see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`.
  114. .. setting:: CACHES
  115. CACHES
  116. ------
  117. Default::
  118. {
  119. 'default': {
  120. 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
  121. }
  122. }
  123. A dictionary containing the settings for all caches to be used with
  124. Django. It is a nested dictionary whose contents maps cache aliases
  125. to a dictionary containing the options for an individual cache.
  126. The :setting:`CACHES` setting must configure a ``default`` cache;
  127. any number of additional caches may also be specified. If you
  128. are using a cache backend other than the local memory cache, or
  129. you need to define multiple caches, other options will be required.
  130. The following cache options are available.
  131. .. setting:: CACHES-BACKEND
  132. BACKEND
  133. ~~~~~~~
  134. Default: ``''`` (Empty string)
  135. The cache backend to use. The built-in cache backends are:
  136. * ``'django.core.cache.backends.db.DatabaseCache'``
  137. * ``'django.core.cache.backends.dummy.DummyCache'``
  138. * ``'django.core.cache.backends.filebased.FileBasedCache'``
  139. * ``'django.core.cache.backends.locmem.LocMemCache'``
  140. * ``'django.core.cache.backends.memcached.MemcachedCache'``
  141. * ``'django.core.cache.backends.memcached.PyLibMCCache'``
  142. You can use a cache backend that doesn't ship with Django by setting
  143. :setting:`BACKEND <CACHES-BACKEND>` to a fully-qualified path of a cache
  144. backend class (i.e. ``mypackage.backends.whatever.WhateverCache``).
  145. .. setting:: CACHES-KEY_FUNCTION
  146. KEY_FUNCTION
  147. ~~~~~~~~~~~~
  148. A string containing a dotted path to a function (or any callable) that defines how to
  149. compose a prefix, version and key into a final cache key. The default
  150. implementation is equivalent to the function::
  151. def make_key(key, key_prefix, version):
  152. return ':'.join([key_prefix, str(version), key])
  153. You may use any key function you want, as long as it has the same
  154. argument signature.
  155. See the :ref:`cache documentation <cache_key_transformation>` for more
  156. information.
  157. .. setting:: CACHES-KEY_PREFIX
  158. KEY_PREFIX
  159. ~~~~~~~~~~
  160. Default: ``''`` (Empty string)
  161. A string that will be automatically included (prepended by default) to
  162. all cache keys used by the Django server.
  163. See the :ref:`cache documentation <cache_key_prefixing>` for more information.
  164. .. setting:: CACHES-LOCATION
  165. LOCATION
  166. ~~~~~~~~
  167. Default: ``''`` (Empty string)
  168. The location of the cache to use. This might be the directory for a
  169. file system cache, a host and port for a memcache server, or simply an
  170. identifying name for a local memory cache. e.g.::
  171. CACHES = {
  172. 'default': {
  173. 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
  174. 'LOCATION': '/var/tmp/django_cache',
  175. }
  176. }
  177. .. setting:: CACHES-OPTIONS
  178. OPTIONS
  179. ~~~~~~~
  180. Default: None
  181. Extra parameters to pass to the cache backend. Available parameters
  182. vary depending on your cache backend.
  183. Some information on available parameters can be found in the
  184. :doc:`Cache Backends </topics/cache>` documentation. For more information,
  185. consult your backend module's own documentation.
  186. .. setting:: CACHES-TIMEOUT
  187. TIMEOUT
  188. ~~~~~~~
  189. Default: 300
  190. The number of seconds before a cache entry is considered stale.
  191. .. versionadded:: 1.7
  192. If the value of this settings is ``None``, cache entries will not expire.
  193. .. setting:: CACHES-VERSION
  194. VERSION
  195. ~~~~~~~
  196. Default: ``1``
  197. The default version number for cache keys generated by the Django server.
  198. See the :ref:`cache documentation <cache_versioning>` for more information.
  199. .. setting:: CACHE_MIDDLEWARE_ALIAS
  200. CACHE_MIDDLEWARE_ALIAS
  201. ----------------------
  202. Default: ``default``
  203. The cache connection to use for the :ref:`cache middleware
  204. <the-per-site-cache>`.
  205. .. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
  206. CACHE_MIDDLEWARE_KEY_PREFIX
  207. ---------------------------
  208. Default: ``''`` (Empty string)
  209. A string which will be prefixed to the cache keys generated by the :ref:`cache
  210. middleware <the-per-site-cache>`. This prefix is combined with the
  211. :setting:`KEY_PREFIX <CACHES-KEY_PREFIX>` setting; it does not replace it.
  212. See :doc:`/topics/cache`.
  213. .. setting:: CACHE_MIDDLEWARE_SECONDS
  214. CACHE_MIDDLEWARE_SECONDS
  215. ------------------------
  216. Default: ``600``
  217. The default number of seconds to cache a page for the :ref:`cache middleware
  218. <the-per-site-cache>`.
  219. See :doc:`/topics/cache`.
  220. .. _settings-csrf:
  221. .. setting:: CSRF_COOKIE_AGE
  222. CSRF_COOKIE_AGE
  223. ---------------
  224. .. versionadded:: 1.7
  225. Default: ``31449600`` (1 year, in seconds)
  226. The age of CSRF cookies, in seconds.
  227. The reason for setting a long-lived expiration time is to avoid problems in
  228. the case of a user closing a browser or bookmarking a page and then loading
  229. that page from a browser cache. Without persistent cookies, the form submission
  230. would fail in this case.
  231. Some browsers (specifically Internet Explorer) can disallow the use of
  232. persistent cookies or can have the indexes to the cookie jar corrupted on disk,
  233. thereby causing CSRF protection checks to fail (and sometimes intermittently).
  234. Change this setting to ``None`` to use session-based CSRF cookies, which
  235. keep the cookies in-memory instead of on persistent storage.
  236. .. setting:: CSRF_COOKIE_DOMAIN
  237. CSRF_COOKIE_DOMAIN
  238. ------------------
  239. Default: ``None``
  240. The domain to be used when setting the CSRF cookie. This can be useful for
  241. easily allowing cross-subdomain requests to be excluded from the normal cross
  242. site request forgery protection. It should be set to a string such as
  243. ``".example.com"`` to allow a POST request from a form on one subdomain to be
  244. accepted by a view served from another subdomain.
  245. Please note that the presence of this setting does not imply that Django's CSRF
  246. protection is safe from cross-subdomain attacks by default - please see the
  247. :ref:`CSRF limitations <csrf-limitations>` section.
  248. .. setting:: CSRF_COOKIE_HTTPONLY
  249. CSRF_COOKIE_HTTPONLY
  250. --------------------
  251. Default: ``False``
  252. Whether to use ``HttpOnly`` flag on the CSRF cookie. If this is set to
  253. ``True``, client-side JavaScript will not to be able to access the CSRF cookie.
  254. This can help prevent malicious JavaScript from bypassing CSRF protection. If
  255. you enable this and need to send the value of the CSRF token with Ajax requests,
  256. your JavaScript will need to pull the value from a hidden CSRF token form input
  257. on the page instead of from the cookie.
  258. See :setting:`SESSION_COOKIE_HTTPONLY` for details on ``HttpOnly``.
  259. .. setting:: CSRF_COOKIE_NAME
  260. CSRF_COOKIE_NAME
  261. ----------------
  262. Default: ``'csrftoken'``
  263. The name of the cookie to use for the CSRF authentication token. This can be whatever you
  264. want. See :doc:`/ref/csrf`.
  265. .. setting:: CSRF_COOKIE_PATH
  266. CSRF_COOKIE_PATH
  267. ----------------
  268. Default: ``'/'``
  269. The path set on the CSRF cookie. This should either match the URL path of your
  270. Django installation or be a parent of that path.
  271. This is useful if you have multiple Django instances running under the same
  272. hostname. They can use different cookie paths, and each instance will only see
  273. its own CSRF cookie.
  274. .. setting:: CSRF_COOKIE_SECURE
  275. CSRF_COOKIE_SECURE
  276. ------------------
  277. Default: ``False``
  278. Whether to use a secure cookie for the CSRF cookie. If this is set to ``True``,
  279. the cookie will be marked as "secure," which means browsers may ensure that the
  280. cookie is only sent under an HTTPS connection.
  281. .. setting:: CSRF_FAILURE_VIEW
  282. CSRF_FAILURE_VIEW
  283. -----------------
  284. Default: ``'django.views.csrf.csrf_failure'``
  285. A dotted path to the view function to be used when an incoming request
  286. is rejected by the CSRF protection. The function should have this signature::
  287. def csrf_failure(request, reason="")
  288. where ``reason`` is a short message (intended for developers or logging, not for
  289. end users) indicating the reason the request was rejected. See
  290. :doc:`/ref/csrf`.
  291. .. setting:: DATABASES
  292. DATABASES
  293. ---------
  294. Default: ``{}`` (Empty dictionary)
  295. A dictionary containing the settings for all databases to be used with
  296. Django. It is a nested dictionary whose contents maps database aliases
  297. to a dictionary containing the options for an individual database.
  298. The :setting:`DATABASES` setting must configure a ``default`` database;
  299. any number of additional databases may also be specified.
  300. The simplest possible settings file is for a single-database setup using
  301. SQLite. This can be configured using the following::
  302. DATABASES = {
  303. 'default': {
  304. 'ENGINE': 'django.db.backends.sqlite3',
  305. 'NAME': 'mydatabase',
  306. }
  307. }
  308. When connecting to other database backends, such as MySQL, Oracle, or
  309. PostgreSQL, additional connection parameters will be required. See
  310. the :setting:`ENGINE <DATABASE-ENGINE>` setting below on how to specify
  311. other database types. This example is for PostgreSQL::
  312. DATABASES = {
  313. 'default': {
  314. 'ENGINE': 'django.db.backends.postgresql_psycopg2',
  315. 'NAME': 'mydatabase',
  316. 'USER': 'mydatabaseuser',
  317. 'PASSWORD': 'mypassword',
  318. 'HOST': '127.0.0.1',
  319. 'PORT': '5432',
  320. }
  321. }
  322. The following inner options that may be required for more complex
  323. configurations are available:
  324. .. setting:: DATABASE-ATOMIC_REQUESTS
  325. ATOMIC_REQUESTS
  326. ~~~~~~~~~~~~~~~
  327. Default: ``False``
  328. Set this to ``True`` to wrap each HTTP request in a transaction on this
  329. database. See :ref:`tying-transactions-to-http-requests`.
  330. .. setting:: DATABASE-AUTOCOMMIT
  331. AUTOCOMMIT
  332. ~~~~~~~~~~
  333. Default: ``True``
  334. Set this to ``False`` if you want to :ref:`disable Django's transaction
  335. management <deactivate-transaction-management>` and implement your own.
  336. .. setting:: DATABASE-ENGINE
  337. ENGINE
  338. ~~~~~~
  339. Default: ``''`` (Empty string)
  340. The database backend to use. The built-in database backends are:
  341. * ``'django.db.backends.postgresql_psycopg2'``
  342. * ``'django.db.backends.mysql'``
  343. * ``'django.db.backends.sqlite3'``
  344. * ``'django.db.backends.oracle'``
  345. You can use a database backend that doesn't ship with Django by setting
  346. ``ENGINE`` to a fully-qualified path (i.e.
  347. ``mypackage.backends.whatever``).
  348. .. setting:: HOST
  349. HOST
  350. ~~~~
  351. Default: ``''`` (Empty string)
  352. Which host to use when connecting to the database. An empty string means
  353. localhost. Not used with SQLite.
  354. If this value starts with a forward slash (``'/'``) and you're using MySQL,
  355. MySQL will connect via a Unix socket to the specified socket. For example::
  356. "HOST": '/var/run/mysql'
  357. If you're using MySQL and this value *doesn't* start with a forward slash, then
  358. this value is assumed to be the host.
  359. If you're using PostgreSQL, by default (empty :setting:`HOST`), the connection
  360. to the database is done through UNIX domain sockets ('local' lines in
  361. ``pg_hba.conf``). If your UNIX domain socket is not in the standard location,
  362. use the same value of ``unix_socket_directory`` from ``postgresql.conf``.
  363. If you want to connect through TCP sockets, set :setting:`HOST` to 'localhost'
  364. or '127.0.0.1' ('host' lines in ``pg_hba.conf``).
  365. On Windows, you should always define :setting:`HOST`, as UNIX domain sockets
  366. are not available.
  367. .. setting:: NAME
  368. NAME
  369. ~~~~
  370. Default: ``''`` (Empty string)
  371. The name of the database to use. For SQLite, it's the full path to the database
  372. file. When specifying the path, always use forward slashes, even on Windows
  373. (e.g. ``C:/homes/user/mysite/sqlite3.db``).
  374. .. setting:: CONN_MAX_AGE
  375. CONN_MAX_AGE
  376. ~~~~~~~~~~~~
  377. Default: ``0``
  378. The lifetime of a database connection, in seconds. Use ``0`` to close database
  379. connections at the end of each request — Django's historical behavior — and
  380. ``None`` for unlimited persistent connections.
  381. .. setting:: OPTIONS
  382. OPTIONS
  383. ~~~~~~~
  384. Default: ``{}`` (Empty dictionary)
  385. Extra parameters to use when connecting to the database. Available parameters
  386. vary depending on your database backend.
  387. Some information on available parameters can be found in the
  388. :doc:`Database Backends </ref/databases>` documentation. For more information,
  389. consult your backend module's own documentation.
  390. .. setting:: PASSWORD
  391. PASSWORD
  392. ~~~~~~~~
  393. Default: ``''`` (Empty string)
  394. The password to use when connecting to the database. Not used with SQLite.
  395. .. setting:: PORT
  396. PORT
  397. ~~~~
  398. Default: ``''`` (Empty string)
  399. The port to use when connecting to the database. An empty string means the
  400. default port. Not used with SQLite.
  401. .. setting:: USER
  402. USER
  403. ~~~~
  404. Default: ``''`` (Empty string)
  405. The username to use when connecting to the database. Not used with SQLite.
  406. .. setting:: DATABASE-TEST
  407. TEST
  408. ~~~~
  409. .. versionchanged:: 1.7
  410. All :setting:`TEST <DATABASE-TEST>` sub-entries used to be independent
  411. entries in the database settings dictionary, with a ``TEST_`` prefix.
  412. For backwards compatibility with older versions of Django, you can define
  413. both versions of the settings as long as they match.
  414. Further, ``TEST_CREATE``, ``TEST_USER_CREATE`` and ``TEST_PASSWD``
  415. were changed to ``CREATE_DB``, ``CREATE_USER`` and ``PASSWORD``
  416. respectively.
  417. Default: ``{}``
  418. A dictionary of settings for test databases; for more details about the
  419. creation and use of test databases, see :ref:`the-test-database`. The
  420. following entries are available:
  421. .. setting:: TEST_CHARSET
  422. CHARSET
  423. ^^^^^^^
  424. Default: ``None``
  425. The character set encoding used to create the test database. The value of this
  426. string is passed directly through to the database, so its format is
  427. backend-specific.
  428. Supported for the PostgreSQL_ (``postgresql_psycopg2``) and MySQL_ (``mysql``)
  429. backends.
  430. .. _PostgreSQL: http://www.postgresql.org/docs/current/static/multibyte.html
  431. .. _MySQL: http://dev.mysql.com/doc/refman/5.6/en/charset-database.html
  432. .. setting:: TEST_COLLATION
  433. COLLATION
  434. ^^^^^^^^^
  435. Default: ``None``
  436. The collation order to use when creating the test database. This value is
  437. passed directly to the backend, so its format is backend-specific.
  438. Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
  439. .. _MySQL manual: MySQL_
  440. .. setting:: TEST_DEPENDENCIES
  441. DEPENDENCIES
  442. ^^^^^^^^^^^^
  443. Default: ``['default']``, for all databases other than ``default``,
  444. which has no dependencies.
  445. The creation-order dependencies of the database. See the documentation
  446. on :ref:`controlling the creation order of test databases
  447. <topics-testing-creation-dependencies>` for details.
  448. .. setting:: TEST_MIRROR
  449. MIRROR
  450. ^^^^^^
  451. Default: ``None``
  452. The alias of the database that this database should mirror during
  453. testing.
  454. This setting exists to allow for testing of primary/replica
  455. (referred to as master/slave by some databases)
  456. configurations of multiple databases. See the documentation on
  457. :ref:`testing primary/replica configurations
  458. <topics-testing-primaryreplica>` for details.
  459. .. setting:: TEST_NAME
  460. NAME
  461. ^^^^
  462. Default: ``None``
  463. The name of database to use when running the test suite.
  464. If the default value (``None``) is used with the SQLite database engine, the
  465. tests will use a memory resident database. For all other database engines the
  466. test database will use the name ``'test_' + DATABASE_NAME``.
  467. See :ref:`the-test-database`.
  468. .. setting:: TEST_SERIALIZE
  469. SERIALIZE
  470. ^^^^^^^^^
  471. .. versionadded:: 1.7.1
  472. Boolean value to control whether or not the default test runner serializes the
  473. database into an in-memory JSON string before running tests (used to restore
  474. the database state between tests if you don't have transactions). You can set
  475. this to ``False`` to speed up creation time if you don't have any test classes
  476. with :ref:`serialized_rollback=True <test-case-serialized-rollback>`.
  477. .. setting:: TEST_CREATE
  478. CREATE_DB
  479. ^^^^^^^^^
  480. Default: ``True``
  481. This is an Oracle-specific setting.
  482. If it is set to ``False``, the test tablespaces won't be automatically created
  483. at the beginning of the tests and dropped at the end.
  484. .. setting:: TEST_USER_CREATE
  485. CREATE_USER
  486. ^^^^^^^^^^^
  487. Default: ``True``
  488. This is an Oracle-specific setting.
  489. If it is set to ``False``, the test user won't be automatically created at the
  490. beginning of the tests and dropped at the end.
  491. .. setting:: TEST_USER
  492. USER
  493. ^^^^
  494. Default: ``None``
  495. This is an Oracle-specific setting.
  496. The username to use when connecting to the Oracle database that will be used
  497. when running tests. If not provided, Django will use ``'test_' + USER``.
  498. .. setting:: TEST_PASSWD
  499. PASSWORD
  500. ^^^^^^^^
  501. Default: ``None``
  502. This is an Oracle-specific setting.
  503. The password to use when connecting to the Oracle database that will be used
  504. when running tests. If not provided, Django will use a hardcoded default value.
  505. .. setting:: TEST_TBLSPACE
  506. TBLSPACE
  507. ^^^^^^^^
  508. Default: ``None``
  509. This is an Oracle-specific setting.
  510. The name of the tablespace that will be used when running tests. If not
  511. provided, Django will use ``'test_' + USER``.
  512. .. versionchanged:: 1.8
  513. Previously Django used ``'test_' + NAME`` if not provided.
  514. .. setting:: TEST_TBLSPACE_TMP
  515. TBLSPACE_TMP
  516. ^^^^^^^^^^^^
  517. Default: ``None``
  518. This is an Oracle-specific setting.
  519. The name of the temporary tablespace that will be used when running tests. If
  520. not provided, Django will use ``'test_' + USER + '_temp'``.
  521. .. versionchanged:: 1.8
  522. Previously Django used ``'test_' + NAME + '_temp'`` if not provided.
  523. .. setting:: DATAFILE
  524. DATAFILE
  525. ^^^^^^^^
  526. .. versionadded:: 1.8
  527. Default: ``None``
  528. This is an Oracle-specific setting.
  529. The name of the datafile to use for the TBLSPACE. If not provided, Django will
  530. use ``TBLSPACE + '.dbf'``.
  531. .. setting:: DATAFILE_TMP
  532. DATAFILE_TMP
  533. ^^^^^^^^^^^^
  534. .. versionadded:: 1.8
  535. Default: ``None``
  536. This is an Oracle-specific setting.
  537. The name of the datafile to use for the TBLSPACE_TMP. If not provided, Django
  538. will use ``TBLSPACE_TMP + '.dbf'``.
  539. .. setting:: DATAFILE_MAXSIZE
  540. DATAFILE_MAXSIZE
  541. ^^^^^^^^^^^^^^^^
  542. .. versionadded:: 1.8
  543. Default: ``'500M'``
  544. .. versionchanged:: 1.8
  545. The previous value was 200M and was not user customizable.
  546. This is an Oracle-specific setting.
  547. The maximum size that the DATAFILE is allowed to grow to.
  548. .. setting:: DATAFILE_TMP_MAXSIZE
  549. DATAFILE_TMP_MAXSIZE
  550. ^^^^^^^^^^^^^^^^^^^^
  551. .. versionadded:: 1.8
  552. Default: ``'500M'``
  553. .. versionchanged:: 1.8
  554. The previous value was 200M and was not user customizable.
  555. This is an Oracle-specific setting.
  556. The maximum size that the DATAFILE_TMP is allowed to grow to.
  557. .. setting:: OLD_TEST_CHARSET
  558. TEST_CHARSET
  559. ~~~~~~~~~~~~
  560. .. deprecated:: 1.7
  561. Use the :setting:`CHARSET <TEST_CHARSET>` entry in the
  562. :setting:`TEST <DATABASE-TEST>` dictionary.
  563. .. setting:: OLD_TEST_COLLATION
  564. TEST_COLLATION
  565. ~~~~~~~~~~~~~~
  566. .. deprecated:: 1.7
  567. Use the :setting:`COLLATION <TEST_COLLATION>` entry in the
  568. :setting:`TEST <DATABASE-TEST>` dictionary.
  569. .. setting:: OLD_TEST_DEPENDENCIES
  570. TEST_DEPENDENCIES
  571. ~~~~~~~~~~~~~~~~~
  572. .. deprecated:: 1.7
  573. Use the :setting:`DEPENDENCIES <TEST_DEPENDENCIES>` entry in the
  574. :setting:`TEST <DATABASE-TEST>` dictionary.
  575. .. setting:: OLD_TEST_MIRROR
  576. TEST_MIRROR
  577. ~~~~~~~~~~~
  578. .. deprecated:: 1.7
  579. Use the :setting:`MIRROR <TEST_MIRROR>` entry in the
  580. :setting:`TEST <DATABASE-TEST>` dictionary.
  581. .. setting:: OLD_TEST_NAME
  582. TEST_NAME
  583. ~~~~~~~~~
  584. .. deprecated:: 1.7
  585. Use the :setting:`NAME <TEST_NAME>` entry in the
  586. :setting:`TEST <DATABASE-TEST>` dictionary.
  587. .. setting:: OLD_TEST_CREATE
  588. TEST_CREATE
  589. ~~~~~~~~~~~
  590. .. deprecated:: 1.7
  591. Use the :setting:`CREATE_DB <TEST_CREATE>` entry in the
  592. :setting:`TEST <DATABASE-TEST>` dictionary.
  593. .. setting:: OLD_TEST_USER
  594. TEST_USER
  595. ~~~~~~~~~
  596. .. deprecated:: 1.7
  597. Use the :setting:`USER <TEST_USER>` entry in the
  598. :setting:`TEST <DATABASE-TEST>` dictionary.
  599. .. setting:: OLD_TEST_USER_CREATE
  600. TEST_USER_CREATE
  601. ~~~~~~~~~~~~~~~~
  602. .. deprecated:: 1.7
  603. Use the :setting:`CREATE_USER <TEST_USER_CREATE>` entry in the
  604. :setting:`TEST <DATABASE-TEST>` dictionary.
  605. .. setting:: OLD_TEST_PASSWD
  606. TEST_PASSWD
  607. ~~~~~~~~~~~
  608. .. deprecated:: 1.7
  609. Use the :setting:`PASSWORD <TEST_PASSWD>` entry in the
  610. :setting:`TEST <DATABASE-TEST>` dictionary.
  611. .. setting:: OLD_TEST_TBLSPACE
  612. TEST_TBLSPACE
  613. ~~~~~~~~~~~~~
  614. .. deprecated:: 1.7
  615. Use the :setting:`TBLSPACE <TEST_TBLSPACE>` entry in the
  616. :setting:`TEST <DATABASE-TEST>` dictionary.
  617. .. setting:: OLD_TEST_TBLSPACE_TMP
  618. TEST_TBLSPACE_TMP
  619. ~~~~~~~~~~~~~~~~~
  620. .. deprecated:: 1.7
  621. Use the :setting:`TBLSPACE_TMP <TEST_TBLSPACE_TMP>` entry in the
  622. :setting:`TEST <DATABASE-TEST>` dictionary.
  623. .. setting:: DATABASE_ROUTERS
  624. DATABASE_ROUTERS
  625. ----------------
  626. Default: ``[]`` (Empty list)
  627. The list of routers that will be used to determine which database
  628. to use when performing a database queries.
  629. See the documentation on :ref:`automatic database routing in multi
  630. database configurations <topics-db-multi-db-routing>`.
  631. .. setting:: DATE_FORMAT
  632. DATE_FORMAT
  633. -----------
  634. Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
  635. The default formatting to use for displaying date fields in any part of the
  636. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  637. locale-dictated format has higher precedence and will be applied instead. See
  638. :tfilter:`allowed date format strings <date>`.
  639. See also :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  640. .. setting:: DATE_INPUT_FORMATS
  641. DATE_INPUT_FORMATS
  642. ------------------
  643. Default::
  644. (
  645. '%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', # '2006-10-25', '10/25/2006', '10/25/06'
  646. '%b %d %Y', '%b %d, %Y', # 'Oct 25 2006', 'Oct 25, 2006'
  647. '%d %b %Y', '%d %b, %Y', # '25 Oct 2006', '25 Oct, 2006'
  648. '%B %d %Y', '%B %d, %Y', # 'October 25 2006', 'October 25, 2006'
  649. '%d %B %Y', '%d %B, %Y', # '25 October 2006', '25 October, 2006'
  650. )
  651. A tuple of formats that will be accepted when inputting data on a date field.
  652. Formats will be tried in order, using the first valid one. Note that these
  653. format strings use Python's datetime_ module syntax, not the format strings
  654. from the ``date`` Django template tag.
  655. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  656. precedence and will be applied instead.
  657. See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  658. .. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior
  659. .. setting:: DATETIME_FORMAT
  660. DATETIME_FORMAT
  661. ---------------
  662. Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
  663. The default formatting to use for displaying datetime fields in any part of the
  664. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  665. locale-dictated format has higher precedence and will be applied instead. See
  666. :tfilter:`allowed date format strings <date>`.
  667. See also :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  668. .. setting:: DATETIME_INPUT_FORMATS
  669. DATETIME_INPUT_FORMATS
  670. ----------------------
  671. Default::
  672. (
  673. '%Y-%m-%d %H:%M:%S', # '2006-10-25 14:30:59'
  674. '%Y-%m-%d %H:%M:%S.%f', # '2006-10-25 14:30:59.000200'
  675. '%Y-%m-%d %H:%M', # '2006-10-25 14:30'
  676. '%Y-%m-%d', # '2006-10-25'
  677. '%m/%d/%Y %H:%M:%S', # '10/25/2006 14:30:59'
  678. '%m/%d/%Y %H:%M:%S.%f', # '10/25/2006 14:30:59.000200'
  679. '%m/%d/%Y %H:%M', # '10/25/2006 14:30'
  680. '%m/%d/%Y', # '10/25/2006'
  681. '%m/%d/%y %H:%M:%S', # '10/25/06 14:30:59'
  682. '%m/%d/%y %H:%M:%S.%f', # '10/25/06 14:30:59.000200'
  683. '%m/%d/%y %H:%M', # '10/25/06 14:30'
  684. '%m/%d/%y', # '10/25/06'
  685. )
  686. A tuple of formats that will be accepted when inputting data on a datetime
  687. field. Formats will be tried in order, using the first valid one. Note that
  688. these format strings use Python's datetime_ module syntax, not the format
  689. strings from the ``date`` Django template tag.
  690. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  691. precedence and will be applied instead.
  692. See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  693. .. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior
  694. .. setting:: DEBUG
  695. DEBUG
  696. -----
  697. Default: ``False``
  698. A boolean that turns on/off debug mode.
  699. Never deploy a site into production with :setting:`DEBUG` turned on.
  700. Did you catch that? NEVER deploy a site into production with :setting:`DEBUG`
  701. turned on.
  702. One of the main features of debug mode is the display of detailed error pages.
  703. If your app raises an exception when :setting:`DEBUG` is ``True``, Django will
  704. display a detailed traceback, including a lot of metadata about your
  705. environment, such as all the currently defined Django settings (from
  706. ``settings.py``).
  707. As a security measure, Django will *not* include settings that might be
  708. sensitive (or offensive), such as :setting:`SECRET_KEY`. Specifically, it will
  709. exclude any setting whose name includes any of the following:
  710. * ``'API'``
  711. * ``'KEY'``
  712. * ``'PASS'``
  713. * ``'SECRET'``
  714. * ``'SIGNATURE'``
  715. * ``'TOKEN'``
  716. Note that these are *partial* matches. ``'PASS'`` will also match PASSWORD,
  717. just as ``'TOKEN'`` will also match TOKENIZED and so on.
  718. Still, note that there are always going to be sections of your debug output
  719. that are inappropriate for public consumption. File paths, configuration
  720. options and the like all give attackers extra information about your server.
  721. It is also important to remember that when running with :setting:`DEBUG`
  722. turned on, Django will remember every SQL query it executes. This is useful
  723. when you're debugging, but it'll rapidly consume memory on a production server.
  724. Finally, if :setting:`DEBUG` is ``False``, you also need to properly set
  725. the :setting:`ALLOWED_HOSTS` setting. Failing to do so will result in all
  726. requests being returned as "Bad Request (400)".
  727. .. _django/views/debug.py: https://github.com/django/django/blob/master/django/views/debug.py
  728. .. setting:: DEBUG_PROPAGATE_EXCEPTIONS
  729. DEBUG_PROPAGATE_EXCEPTIONS
  730. --------------------------
  731. Default: ``False``
  732. If set to True, Django's normal exception handling of view functions
  733. will be suppressed, and exceptions will propagate upwards. This can
  734. be useful for some test setups, and should never be used on a live
  735. site.
  736. .. setting:: DECIMAL_SEPARATOR
  737. DECIMAL_SEPARATOR
  738. -----------------
  739. Default: ``'.'`` (Dot)
  740. Default decimal separator used when formatting decimal numbers.
  741. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  742. format has higher precedence and will be applied instead.
  743. See also :setting:`NUMBER_GROUPING`, :setting:`THOUSAND_SEPARATOR` and
  744. :setting:`USE_THOUSAND_SEPARATOR`.
  745. .. setting:: DEFAULT_CHARSET
  746. DEFAULT_CHARSET
  747. ---------------
  748. Default: ``'utf-8'``
  749. Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
  750. manually specified. Used with :setting:`DEFAULT_CONTENT_TYPE` to construct the
  751. ``Content-Type`` header.
  752. .. setting:: DEFAULT_CONTENT_TYPE
  753. DEFAULT_CONTENT_TYPE
  754. --------------------
  755. Default: ``'text/html'``
  756. Default content type to use for all ``HttpResponse`` objects, if a MIME type
  757. isn't manually specified. Used with :setting:`DEFAULT_CHARSET` to construct
  758. the ``Content-Type`` header.
  759. .. setting:: DEFAULT_EXCEPTION_REPORTER_FILTER
  760. DEFAULT_EXCEPTION_REPORTER_FILTER
  761. ---------------------------------
  762. Default: :class:`django.views.debug.SafeExceptionReporterFilter`
  763. Default exception reporter filter class to be used if none has been assigned to
  764. the :class:`~django.http.HttpRequest` instance yet.
  765. See :ref:`Filtering error reports<filtering-error-reports>`.
  766. .. setting:: DEFAULT_FILE_STORAGE
  767. DEFAULT_FILE_STORAGE
  768. --------------------
  769. Default: :class:`django.core.files.storage.FileSystemStorage`
  770. Default file storage class to be used for any file-related operations that don't
  771. specify a particular storage system. See :doc:`/topics/files`.
  772. .. setting:: DEFAULT_FROM_EMAIL
  773. DEFAULT_FROM_EMAIL
  774. ------------------
  775. Default: ``'webmaster@localhost'``
  776. Default email address to use for various automated correspondence from the
  777. site manager(s). This doesn't include error messages sent to :setting:`ADMINS`
  778. and :setting:`MANAGERS`; for that, see :setting:`SERVER_EMAIL`.
  779. .. setting:: DEFAULT_INDEX_TABLESPACE
  780. DEFAULT_INDEX_TABLESPACE
  781. ------------------------
  782. Default: ``''`` (Empty string)
  783. Default tablespace to use for indexes on fields that don't specify
  784. one, if the backend supports it (see :doc:`/topics/db/tablespaces`).
  785. .. setting:: DEFAULT_TABLESPACE
  786. DEFAULT_TABLESPACE
  787. ------------------
  788. Default: ``''`` (Empty string)
  789. Default tablespace to use for models that don't specify one, if the
  790. backend supports it (see :doc:`/topics/db/tablespaces`).
  791. .. setting:: DISALLOWED_USER_AGENTS
  792. DISALLOWED_USER_AGENTS
  793. ----------------------
  794. Default: ``()`` (Empty tuple)
  795. List of compiled regular expression objects representing User-Agent strings that
  796. are not allowed to visit any page, systemwide. Use this for bad robots/crawlers.
  797. This is only used if ``CommonMiddleware`` is installed (see
  798. :doc:`/topics/http/middleware`).
  799. .. setting:: EMAIL_BACKEND
  800. EMAIL_BACKEND
  801. -------------
  802. Default: ``'django.core.mail.backends.smtp.EmailBackend'``
  803. The backend to use for sending emails. For the list of available backends see
  804. :doc:`/topics/email`.
  805. .. setting:: EMAIL_FILE_PATH
  806. EMAIL_FILE_PATH
  807. ---------------
  808. Default: Not defined
  809. The directory used by the ``file`` email backend to store output files.
  810. .. setting:: EMAIL_HOST
  811. EMAIL_HOST
  812. ----------
  813. Default: ``'localhost'``
  814. The host to use for sending email.
  815. See also :setting:`EMAIL_PORT`.
  816. .. setting:: EMAIL_HOST_PASSWORD
  817. EMAIL_HOST_PASSWORD
  818. -------------------
  819. Default: ``''`` (Empty string)
  820. Password to use for the SMTP server defined in :setting:`EMAIL_HOST`. This
  821. setting is used in conjunction with :setting:`EMAIL_HOST_USER` when
  822. authenticating to the SMTP server. If either of these settings is empty,
  823. Django won't attempt authentication.
  824. See also :setting:`EMAIL_HOST_USER`.
  825. .. setting:: EMAIL_HOST_USER
  826. EMAIL_HOST_USER
  827. ---------------
  828. Default: ``''`` (Empty string)
  829. Username to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  830. If empty, Django won't attempt authentication.
  831. See also :setting:`EMAIL_HOST_PASSWORD`.
  832. .. setting:: EMAIL_PORT
  833. EMAIL_PORT
  834. ----------
  835. Default: ``25``
  836. Port to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  837. .. setting:: EMAIL_SUBJECT_PREFIX
  838. EMAIL_SUBJECT_PREFIX
  839. --------------------
  840. Default: ``'[Django] '``
  841. Subject-line prefix for email messages sent with ``django.core.mail.mail_admins``
  842. or ``django.core.mail.mail_managers``. You'll probably want to include the
  843. trailing space.
  844. .. setting:: EMAIL_USE_TLS
  845. EMAIL_USE_TLS
  846. -------------
  847. Default: ``False``
  848. Whether to use a TLS (secure) connection when talking to the SMTP server.
  849. This is used for explicit TLS connections, generally on port 587. If you are
  850. experiencing hanging connections, see the implicit TLS setting
  851. :setting:`EMAIL_USE_SSL`.
  852. .. setting:: EMAIL_USE_SSL
  853. EMAIL_USE_SSL
  854. -------------
  855. .. versionadded:: 1.7
  856. Default: ``False``
  857. Whether to use an implicit TLS (secure) connection when talking to the SMTP
  858. server. In most email documentation this type of TLS connection is referred
  859. to as SSL. It is generally used on port 465. If you are experiencing problems,
  860. see the explicit TLS setting :setting:`EMAIL_USE_TLS`.
  861. Note that :setting:`EMAIL_USE_TLS`/:setting:`EMAIL_USE_SSL` are mutually
  862. exclusive, so only set one of those settings to ``True``.
  863. .. setting:: EMAIL_SSL_CERTFILE
  864. EMAIL_SSL_CERTFILE
  865. ------------------
  866. .. versionadded:: 1.8
  867. Default: ``None``
  868. If :setting:`EMAIL_USE_SSL` or :setting:`EMAIL_USE_TLS` is ``True``, you can
  869. optionally specify the path to a PEM-formatted certificate chain file to use
  870. for the SSL connection.
  871. .. setting:: EMAIL_SSL_KEYFILE
  872. EMAIL_SSL_KEYFILE
  873. -----------------
  874. .. versionadded:: 1.8
  875. Default: ``None``
  876. If :setting:`EMAIL_USE_SSL` or :setting:`EMAIL_USE_TLS` is ``True``, you can
  877. optionally specify the path to a PEM-formatted private key file to use for the
  878. SSL connection.
  879. Note that setting :setting:`EMAIL_SSL_CERTFILE` and :setting:`EMAIL_SSL_KEYFILE`
  880. doesn't result in any certificate checking. They're passed to the underlying SSL
  881. connection. Please refer to the documentation of Python's
  882. :func:`python:ssl.wrap_socket` function for details on how the certificate chain
  883. file and private key file are handled.
  884. .. setting:: EMAIL_TIMEOUT
  885. EMAIL_TIMEOUT
  886. -------------
  887. .. versionadded:: 1.8
  888. Default: ``None``
  889. Specifies a timeout in seconds for blocking operations like the connection
  890. attempt.
  891. .. setting:: FILE_CHARSET
  892. FILE_CHARSET
  893. ------------
  894. Default: ``'utf-8'``
  895. The character encoding used to decode any files read from disk. This includes
  896. template files and initial SQL data files.
  897. .. setting:: FILE_UPLOAD_HANDLERS
  898. FILE_UPLOAD_HANDLERS
  899. --------------------
  900. Default::
  901. ("django.core.files.uploadhandler.MemoryFileUploadHandler",
  902. "django.core.files.uploadhandler.TemporaryFileUploadHandler")
  903. A tuple of handlers to use for uploading. Changing this setting allows complete
  904. customization -- even replacement -- of Django's upload process.
  905. See :doc:`/topics/files` for details.
  906. .. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
  907. FILE_UPLOAD_MAX_MEMORY_SIZE
  908. ---------------------------
  909. Default: ``2621440`` (i.e. 2.5 MB).
  910. The maximum size (in bytes) that an upload will be before it gets streamed to
  911. the file system. See :doc:`/topics/files` for details.
  912. .. setting:: FILE_UPLOAD_DIRECTORY_PERMISSIONS
  913. FILE_UPLOAD_DIRECTORY_PERMISSIONS
  914. ---------------------------------
  915. .. versionadded:: 1.7
  916. Default: ``None``
  917. The numeric mode to apply to directories created in the process of uploading
  918. files.
  919. This setting also determines the default permissions for collected static
  920. directories when using the :djadmin:`collectstatic` management command. See
  921. :djadmin:`collectstatic` for details on overriding it.
  922. This value mirrors the functionality and caveats of the
  923. :setting:`FILE_UPLOAD_PERMISSIONS` setting.
  924. .. setting:: FILE_UPLOAD_PERMISSIONS
  925. FILE_UPLOAD_PERMISSIONS
  926. -----------------------
  927. Default: ``None``
  928. The numeric mode (i.e. ``0o644``) to set newly uploaded files to. For
  929. more information about what these modes mean, see the documentation for
  930. :func:`os.chmod`.
  931. If this isn't given or is ``None``, you'll get operating-system
  932. dependent behavior. On most platforms, temporary files will have a mode
  933. of ``0o600``, and files saved from memory will be saved using the
  934. system's standard umask.
  935. For security reasons, these permissions aren't applied to the temporary files
  936. that are stored in :setting:`FILE_UPLOAD_TEMP_DIR`.
  937. This setting also determines the default permissions for collected static files
  938. when using the :djadmin:`collectstatic` management command. See
  939. :djadmin:`collectstatic` for details on overriding it.
  940. .. warning::
  941. **Always prefix the mode with a 0.**
  942. If you're not familiar with file modes, please note that the leading
  943. ``0`` is very important: it indicates an octal number, which is the
  944. way that modes must be specified. If you try to use ``644``, you'll
  945. get totally incorrect behavior.
  946. .. setting:: FILE_UPLOAD_TEMP_DIR
  947. FILE_UPLOAD_TEMP_DIR
  948. --------------------
  949. Default: ``None``
  950. The directory to store data (typically files larger than
  951. :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`) temporarily while uploading files.
  952. If ``None``, Django will use the standard temporary directory for the operating
  953. system. For example, this will default to ``/tmp`` on \*nix-style operating
  954. systems.
  955. See :doc:`/topics/files` for details.
  956. .. setting:: FIRST_DAY_OF_WEEK
  957. FIRST_DAY_OF_WEEK
  958. -----------------
  959. Default: ``0`` (Sunday)
  960. Number representing the first day of the week. This is especially useful
  961. when displaying a calendar. This value is only used when not using
  962. format internationalization, or when a format cannot be found for the
  963. current locale.
  964. The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
  965. Monday and so on.
  966. .. setting:: FIXTURE_DIRS
  967. FIXTURE_DIRS
  968. -------------
  969. Default: ``()`` (Empty tuple)
  970. List of directories searched for fixture files, in addition to the
  971. ``fixtures`` directory of each application, in search order.
  972. Note that these paths should use Unix-style forward slashes, even on Windows.
  973. See :ref:`initial-data-via-fixtures` and :ref:`topics-testing-fixtures`.
  974. .. setting:: FORCE_SCRIPT_NAME
  975. FORCE_SCRIPT_NAME
  976. ------------------
  977. Default: ``None``
  978. If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
  979. environment variable in any HTTP request. This setting can be used to override
  980. the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
  981. of the preferred value or not supplied at all.
  982. .. setting:: FORMAT_MODULE_PATH
  983. FORMAT_MODULE_PATH
  984. ------------------
  985. Default: ``None``
  986. A full Python path to a Python package that contains format definitions for
  987. project locales. If not ``None``, Django will check for a ``formats.py``
  988. file, under the directory named as the current locale, and will use the
  989. formats defined on this file.
  990. For example, if :setting:`FORMAT_MODULE_PATH` is set to ``mysite.formats``,
  991. and current language is ``en`` (English), Django will expect a directory tree
  992. like::
  993. mysite/
  994. formats/
  995. __init__.py
  996. en/
  997. __init__.py
  998. formats.py
  999. .. versionchanged:: 1.8
  1000. You can also set this setting to a list of Python paths, for example::
  1001. FORMAT_MODULE_PATH = [
  1002. 'mysite.formats',
  1003. 'some_app.formats',
  1004. ]
  1005. When Django searches for a certain format, it will go through all given
  1006. Python paths until it finds a module that actually defines the given
  1007. format. This means that formats defined in packages farther up in the list
  1008. will take precedence over the same formats in packages farther down.
  1009. Available formats are :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT`,
  1010. :setting:`DATETIME_FORMAT`, :setting:`YEAR_MONTH_FORMAT`,
  1011. :setting:`MONTH_DAY_FORMAT`, :setting:`SHORT_DATE_FORMAT`,
  1012. :setting:`SHORT_DATETIME_FORMAT`, :setting:`FIRST_DAY_OF_WEEK`,
  1013. :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  1014. :setting:`NUMBER_GROUPING`.
  1015. .. setting:: IGNORABLE_404_URLS
  1016. IGNORABLE_404_URLS
  1017. ------------------
  1018. Default: ``()``
  1019. List of compiled regular expression objects describing URLs that should be
  1020. ignored when reporting HTTP 404 errors via email (see
  1021. :doc:`/howto/error-reporting`). Regular expressions are matched against
  1022. :meth:`request's full paths <django.http.HttpRequest.get_full_path>` (including
  1023. query string, if any). Use this if your site does not provide a commonly
  1024. requested file such as ``favicon.ico`` or ``robots.txt``, or if it gets
  1025. hammered by script kiddies.
  1026. This is only used if
  1027. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled (see
  1028. :doc:`/topics/http/middleware`).
  1029. .. setting:: INSTALLED_APPS
  1030. INSTALLED_APPS
  1031. --------------
  1032. Default: ``()`` (Empty tuple)
  1033. A tuple of strings designating all applications that are enabled in this
  1034. Django installation. Each string should be a dotted Python path to:
  1035. * an application configuration class, or
  1036. * a package containing a application.
  1037. :doc:`Learn more about application configurations </ref/applications>`.
  1038. .. versionchanged:: 1.7
  1039. :setting:`INSTALLED_APPS` now supports application configurations.
  1040. .. admonition:: Use the application registry for introspection
  1041. Your code should never access :setting:`INSTALLED_APPS` directly. Use
  1042. :attr:`django.apps.apps` instead.
  1043. .. admonition:: Application names and labels must be unique in
  1044. :setting:`INSTALLED_APPS`
  1045. Application :attr:`names <django.apps.AppConfig.name>` — the dotted Python
  1046. path to the application package — must be unique. There is no way to
  1047. include the same application twice, short of duplicating its code under
  1048. another name.
  1049. Application :attr:`labels <django.apps.AppConfig.label>` — by default the
  1050. final part of the name — must be unique too. For example, you can't
  1051. include both ``django.contrib.auth`` and ``myproject.auth``. However, you
  1052. can relabel an application with a custom configuration that defines a
  1053. different :attr:`~django.apps.AppConfig.label`.
  1054. These rules apply regardless of whether :setting:`INSTALLED_APPS`
  1055. references application configuration classes on application packages.
  1056. When several applications provide different versions of the same resource
  1057. (template, static file, management command, translation), the application
  1058. listed first in :setting:`INSTALLED_APPS` has precedence.
  1059. .. setting:: INTERNAL_IPS
  1060. INTERNAL_IPS
  1061. ------------
  1062. Default: ``()`` (Empty tuple)
  1063. A tuple of IP addresses, as strings, that:
  1064. * See debug comments, when :setting:`DEBUG` is ``True``
  1065. * Receive X headers in admindocs if the ``XViewMiddleware`` is installed (see
  1066. :doc:`/ref/contrib/admin/admindocs`)
  1067. .. setting:: LANGUAGE_CODE
  1068. LANGUAGE_CODE
  1069. -------------
  1070. Default: ``'en-us'``
  1071. A string representing the language code for this installation. This should be in
  1072. standard :term:`language ID format <language code>`. For example, U.S. English
  1073. is ``"en-us"``. See also the `list of language identifiers`_ and
  1074. :doc:`/topics/i18n/index`.
  1075. :setting:`USE_I18N` must be active for this setting to have any effect.
  1076. It serves two purposes:
  1077. * If the locale middleware isn't in use, it decides which translation is served
  1078. to all users.
  1079. * If the locale middleware is active, it provides the fallback translation when
  1080. no translation exist for a given literal to the user's preferred language.
  1081. See :ref:`how-django-discovers-language-preference` for more details.
  1082. .. _list of language identifiers: http://www.i18nguy.com/unicode/language-identifiers.html
  1083. .. setting:: LANGUAGE_COOKIE_AGE
  1084. LANGUAGE_COOKIE_AGE
  1085. -------------------
  1086. .. versionadded:: 1.7
  1087. Default: ``None`` (expires at browser close)
  1088. The age of the language cookie, in seconds.
  1089. .. setting:: LANGUAGE_COOKIE_DOMAIN
  1090. LANGUAGE_COOKIE_DOMAIN
  1091. ----------------------
  1092. .. versionadded:: 1.7
  1093. Default: ``None``
  1094. The domain to use for the language cookie. Set this to a string such as
  1095. ``".example.com"`` (note the leading dot!) for cross-domain cookies, or use
  1096. ``None`` for a standard domain cookie.
  1097. Be cautious when updating this setting on a production site. If you update
  1098. this setting to enable cross-domain cookies on a site that previously used
  1099. standard domain cookies, existing user cookies that have the old domain
  1100. will not be updated. This will result in site users being unable to switch
  1101. the language as long as these cookies persist. The only safe and reliable
  1102. option to perform the switch is to change the language cookie name
  1103. permanently (via the :setting:`LANGUAGE_COOKIE_NAME` setting) and to add
  1104. a middleware that copies the value from the old cookie to a new one and then
  1105. deletes the old one.
  1106. .. setting:: LANGUAGE_COOKIE_NAME
  1107. LANGUAGE_COOKIE_NAME
  1108. --------------------
  1109. Default: ``'django_language'``
  1110. The name of the cookie to use for the language cookie. This can be whatever
  1111. you want (but should be different from :setting:`SESSION_COOKIE_NAME`). See
  1112. :doc:`/topics/i18n/index`.
  1113. .. setting:: LANGUAGE_COOKIE_PATH
  1114. LANGUAGE_COOKIE_PATH
  1115. --------------------
  1116. .. versionadded:: 1.7
  1117. Default: ``/``
  1118. The path set on the language cookie. This should either match the URL path of your
  1119. Django installation or be a parent of that path.
  1120. This is useful if you have multiple Django instances running under the same
  1121. hostname. They can use different cookie paths and each instance will only see
  1122. its own language cookie.
  1123. Be cautious when updating this setting on a production site. If you update this
  1124. setting to use a deeper path than it previously used, existing user cookies that
  1125. have the old path will not be updated. This will result in site users being
  1126. unable to switch the language as long as these cookies persist. The only safe
  1127. and reliable option to perform the switch is to change the language cookie name
  1128. permanently (via the :setting:`LANGUAGE_COOKIE_NAME` setting), and to add
  1129. a middleware that copies the value from the old cookie to a new one and then
  1130. deletes the one.
  1131. .. setting:: LANGUAGES
  1132. LANGUAGES
  1133. ---------
  1134. Default: A tuple of all available languages. This list is continually growing
  1135. and including a copy here would inevitably become rapidly out of date. You can
  1136. see the current list of translated languages by looking in
  1137. ``django/conf/global_settings.py`` (or view the `online source`_).
  1138. .. _online source: https://github.com/django/django/blob/master/django/conf/global_settings.py
  1139. The list is a tuple of two-tuples in the format
  1140. (:term:`language code<language code>`, ``language name``) -- for example,
  1141. ``('ja', 'Japanese')``.
  1142. This specifies which languages are available for language selection. See
  1143. :doc:`/topics/i18n/index`.
  1144. Generally, the default value should suffice. Only set this setting if you want
  1145. to restrict language selection to a subset of the Django-provided languages.
  1146. If you define a custom :setting:`LANGUAGES` setting, you can mark the
  1147. language names as translation strings using the
  1148. :func:`~django.utils.translation.ugettext_lazy` function.
  1149. Here's a sample settings file::
  1150. from django.utils.translation import ugettext_lazy as _
  1151. LANGUAGES = (
  1152. ('de', _('German')),
  1153. ('en', _('English')),
  1154. )
  1155. .. setting:: LOCALE_PATHS
  1156. LOCALE_PATHS
  1157. ------------
  1158. Default: ``()`` (Empty tuple)
  1159. A tuple of directories where Django looks for translation files.
  1160. See :ref:`how-django-discovers-translations`.
  1161. Example::
  1162. LOCALE_PATHS = (
  1163. '/home/www/project/common_files/locale',
  1164. '/var/local/translations/locale',
  1165. )
  1166. Django will look within each of these paths for the ``<locale_code>/LC_MESSAGES``
  1167. directories containing the actual translation files.
  1168. .. setting:: LOGGING
  1169. LOGGING
  1170. -------
  1171. Default: A logging configuration dictionary.
  1172. A data structure containing configuration information. The contents of
  1173. this data structure will be passed as the argument to the
  1174. configuration method described in :setting:`LOGGING_CONFIG`.
  1175. Among other things, the default logging configuration passes HTTP 500 server
  1176. errors to an email log handler when :setting:`DEBUG` is ``False``. See also
  1177. :ref:`configuring-logging`.
  1178. You can see the default logging configuration by looking in
  1179. ``django/utils/log.py`` (or view the `online source`__).
  1180. __ https://github.com/django/django/blob/master/django/utils/log.py
  1181. .. setting:: LOGGING_CONFIG
  1182. LOGGING_CONFIG
  1183. --------------
  1184. Default: ``'logging.config.dictConfig'``
  1185. A path to a callable that will be used to configure logging in the
  1186. Django project. Points at a instance of Python's `dictConfig`_
  1187. configuration method by default.
  1188. If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
  1189. configuration process will be skipped.
  1190. .. versionchanged:: 1.7
  1191. Previously, the default value was ``'django.utils.log.dictConfig'``.
  1192. .. _dictConfig: https://docs.python.org/library/logging.config.html#configuration-dictionary-schema
  1193. .. setting:: MANAGERS
  1194. MANAGERS
  1195. --------
  1196. Default: ``()`` (Empty tuple)
  1197. A tuple in the same format as :setting:`ADMINS` that specifies who should get
  1198. broken link notifications when
  1199. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled.
  1200. .. setting:: MEDIA_ROOT
  1201. MEDIA_ROOT
  1202. ----------
  1203. Default: ``''`` (Empty string)
  1204. Absolute filesystem path to the directory that will hold :doc:`user-uploaded
  1205. files </topics/files>`.
  1206. Example: ``"/var/www/example.com/media/"``
  1207. See also :setting:`MEDIA_URL`.
  1208. .. warning::
  1209. :setting:`MEDIA_ROOT` and :setting:`STATIC_ROOT` must have different
  1210. values. Before :setting:`STATIC_ROOT` was introduced, it was common to
  1211. rely or fallback on :setting:`MEDIA_ROOT` to also serve static files;
  1212. however, since this can have serious security implications, there is a
  1213. validation check to prevent it.
  1214. .. setting:: MEDIA_URL
  1215. MEDIA_URL
  1216. ---------
  1217. Default: ``''`` (Empty string)
  1218. URL that handles the media served from :setting:`MEDIA_ROOT`, used
  1219. for :doc:`managing stored files </topics/files>`. It must end in a slash if set
  1220. to a non-empty value. You will need to :ref:`configure these files to be served
  1221. <serving-uploaded-files-in-development>` in both development and production.
  1222. If you want to use ``{{ MEDIA_URL }}`` in your templates, add
  1223. ``'django.template.context_processors.media'`` in the ``'context_processors'``
  1224. option of :setting:`TEMPLATES`.
  1225. Example: ``"http://media.example.com/"``
  1226. .. warning::
  1227. There are security risks if you are accepting uploaded content from
  1228. untrusted users! See the security guide's topic on
  1229. :ref:`user-uploaded-content-security` for mitigation details.
  1230. .. warning::
  1231. :setting:`MEDIA_URL` and :setting:`STATIC_URL` must have different
  1232. values. See :setting:`MEDIA_ROOT` for more details.
  1233. .. setting:: MIDDLEWARE_CLASSES
  1234. MIDDLEWARE_CLASSES
  1235. ------------------
  1236. Default::
  1237. ('django.middleware.common.CommonMiddleware',
  1238. 'django.middleware.csrf.CsrfViewMiddleware')
  1239. A tuple of middleware classes to use. See :doc:`/topics/http/middleware`.
  1240. .. versionchanged:: 1.7
  1241. :class:`~django.contrib.sessions.middleware.SessionMiddleware`,
  1242. :class:`~django.contrib.auth.middleware.AuthenticationMiddleware`, and
  1243. :class:`~django.contrib.messages.middleware.MessageMiddleware` were removed
  1244. from this setting.
  1245. .. setting:: MIGRATION_MODULES
  1246. MIGRATION_MODULES
  1247. -----------------
  1248. Default::
  1249. {} # empty dictionary
  1250. A dictionary specifying the package where migration modules can be found on a per-app basis. The default value
  1251. of this setting is an empty dictionary, but the default package name for migration modules is ``migrations``.
  1252. Example::
  1253. {'blog': 'blog.db_migrations'}
  1254. In this case, migrations pertaining to the ``blog`` app will be contained in the ``blog.db_migrations`` package.
  1255. If you provide the ``app_label`` argument, :djadmin:`makemigrations` will
  1256. automatically create the package if it doesn't already exist.
  1257. .. setting:: MONTH_DAY_FORMAT
  1258. MONTH_DAY_FORMAT
  1259. ----------------
  1260. Default: ``'F j'``
  1261. The default formatting to use for date fields on Django admin change-list
  1262. pages -- and, possibly, by other parts of the system -- in cases when only the
  1263. month and day are displayed.
  1264. For example, when a Django admin change-list page is being filtered by a date
  1265. drilldown, the header for a given day displays the day and month. Different
  1266. locales have different formats. For example, U.S. English would say
  1267. "January 1," whereas Spanish might say "1 Enero."
  1268. Note that if :setting:`USE_L10N` is set to ``True``, then the corresponding
  1269. locale-dictated format has higher precedence and will be applied.
  1270. See :tfilter:`allowed date format strings <date>`. See also
  1271. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`,
  1272. :setting:`TIME_FORMAT` and :setting:`YEAR_MONTH_FORMAT`.
  1273. .. setting:: NUMBER_GROUPING
  1274. NUMBER_GROUPING
  1275. ----------------
  1276. Default: ``0``
  1277. Number of digits grouped together on the integer part of a number.
  1278. Common use is to display a thousand separator. If this setting is ``0``, then
  1279. no grouping will be applied to the number. If this setting is greater than
  1280. ``0``, then :setting:`THOUSAND_SEPARATOR` will be used as the separator between
  1281. those groups.
  1282. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  1283. format has higher precedence and will be applied instead.
  1284. See also :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  1285. :setting:`USE_THOUSAND_SEPARATOR`.
  1286. .. setting:: PREPEND_WWW
  1287. PREPEND_WWW
  1288. -----------
  1289. Default: ``False``
  1290. Whether to prepend the "www." subdomain to URLs that don't have it. This is only
  1291. used if :class:`~django.middleware.common.CommonMiddleware` is installed
  1292. (see :doc:`/topics/http/middleware`). See also :setting:`APPEND_SLASH`.
  1293. .. setting:: ROOT_URLCONF
  1294. ROOT_URLCONF
  1295. ------------
  1296. Default: Not defined
  1297. A string representing the full Python import path to your root URLconf. For example:
  1298. ``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
  1299. setting the attribute ``urlconf`` on the incoming ``HttpRequest``
  1300. object. See :ref:`how-django-processes-a-request` for details.
  1301. .. setting:: SECRET_KEY
  1302. SECRET_KEY
  1303. ----------
  1304. Default: ``''`` (Empty string)
  1305. A secret key for a particular Django installation. This is used to provide
  1306. :doc:`cryptographic signing </topics/signing>`, and should be set to a unique,
  1307. unpredictable value.
  1308. :djadmin:`django-admin startproject <startproject>` automatically adds a
  1309. randomly-generated ``SECRET_KEY`` to each new project.
  1310. Django will refuse to start if :setting:`SECRET_KEY` is not set.
  1311. .. warning::
  1312. **Keep this value secret.**
  1313. Running Django with a known :setting:`SECRET_KEY` defeats many of Django's
  1314. security protections, and can lead to privilege escalation and remote code
  1315. execution vulnerabilities.
  1316. The secret key is used for:
  1317. * All :doc:`sessions </topics/http/sessions>` if you are using
  1318. any other session backend than ``django.contrib.sessions.backends.cache``,
  1319. or if you use
  1320. :class:`~django.contrib.auth.middleware.SessionAuthenticationMiddleware`
  1321. and are using the default
  1322. :meth:`~django.contrib.auth.models.AbstractBaseUser.get_session_auth_hash()`.
  1323. * All :doc:`messages </ref/contrib/messages>` if you are using
  1324. :class:`~django.contrib.messages.storage.cookie.CookieStorage` or
  1325. :class:`~django.contrib.messages.storage.fallback.FallbackStorage`.
  1326. * :mod:`Form wizard <formtools.wizard.views>` progress when using
  1327. cookie storage with
  1328. :class:`formtools.wizard.views.CookieWizardView`.
  1329. * All :func:`~django.contrib.auth.views.password_reset` tokens.
  1330. * All in progress :mod:`form previews <formtools.preview>`.
  1331. * Any usage of :doc:`cryptographic signing </topics/signing>`, unless a
  1332. different key is provided.
  1333. If you rotate your secret key, all of the above will be invalidated.
  1334. Secret keys are not used for passwords of users and key rotation will not
  1335. affect them.
  1336. .. setting:: SECURE_BROWSER_XSS_FILTER
  1337. SECURE_BROWSER_XSS_FILTER
  1338. -------------------------
  1339. .. versionadded:: 1.8
  1340. Default: ``False``
  1341. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware` sets
  1342. the :ref:`x-xss-protection` header on all responses that do not already have it.
  1343. .. setting:: SECURE_CONTENT_TYPE_NOSNIFF
  1344. SECURE_CONTENT_TYPE_NOSNIFF
  1345. ---------------------------
  1346. .. versionadded:: 1.8
  1347. Default: ``False``
  1348. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware`
  1349. sets the :ref:`x-content-type-options` header on all responses that do not
  1350. already have it.
  1351. .. setting:: SECURE_HSTS_INCLUDE_SUBDOMAINS
  1352. SECURE_HSTS_INCLUDE_SUBDOMAINS
  1353. ------------------------------
  1354. .. versionadded:: 1.8
  1355. Default: ``False``
  1356. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware` adds
  1357. the ``includeSubDomains`` tag to the :ref:`http-strict-transport-security`
  1358. header. It has no effect unless :setting:`SECURE_HSTS_SECONDS` is set to a
  1359. non-zero value.
  1360. .. warning::
  1361. Setting this incorrectly can irreversibly (for some time) break your site.
  1362. Read the :ref:`http-strict-transport-security` documentation first.
  1363. .. setting:: SECURE_HSTS_SECONDS
  1364. SECURE_HSTS_SECONDS
  1365. -------------------
  1366. .. versionadded:: 1.8
  1367. Default: ``0``
  1368. If set to a non-zero integer value, the
  1369. :class:`~django.middleware.security.SecurityMiddleware` sets the
  1370. :ref:`http-strict-transport-security` header on all responses that do not
  1371. already have it.
  1372. .. warning::
  1373. Setting this incorrectly can irreversibly (for some time) break your site.
  1374. Read the :ref:`http-strict-transport-security` documentation first.
  1375. .. setting:: SECURE_PROXY_SSL_HEADER
  1376. SECURE_PROXY_SSL_HEADER
  1377. -----------------------
  1378. Default: ``None``
  1379. A tuple representing a HTTP header/value combination that signifies a request
  1380. is secure. This controls the behavior of the request object's ``is_secure()``
  1381. method.
  1382. This takes some explanation. By default, ``is_secure()`` is able to determine
  1383. whether a request is secure by looking at whether the requested URL uses
  1384. "https://". This is important for Django's CSRF protection, and may be used
  1385. by your own code or third-party apps.
  1386. If your Django app is behind a proxy, though, the proxy may be "swallowing" the
  1387. fact that a request is HTTPS, using a non-HTTPS connection between the proxy
  1388. and Django. In this case, ``is_secure()`` would always return ``False`` -- even
  1389. for requests that were made via HTTPS by the end user.
  1390. In this situation, you'll want to configure your proxy to set a custom HTTP
  1391. header that tells Django whether the request came in via HTTPS, and you'll want
  1392. to set ``SECURE_PROXY_SSL_HEADER`` so that Django knows what header to look
  1393. for.
  1394. You'll need to set a tuple with two elements -- the name of the header to look
  1395. for and the required value. For example::
  1396. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
  1397. Here, we're telling Django that we trust the ``X-Forwarded-Proto`` header
  1398. that comes from our proxy, and any time its value is ``'https'``, then the
  1399. request is guaranteed to be secure (i.e., it originally came in via HTTPS).
  1400. Obviously, you should *only* set this setting if you control your proxy or
  1401. have some other guarantee that it sets/strips this header appropriately.
  1402. Note that the header needs to be in the format as used by ``request.META`` --
  1403. all caps and likely starting with ``HTTP_``. (Remember, Django automatically
  1404. adds ``'HTTP_'`` to the start of x-header names before making the header
  1405. available in ``request.META``.)
  1406. .. warning::
  1407. **You will probably open security holes in your site if you set this
  1408. without knowing what you're doing. And if you fail to set it when you
  1409. should. Seriously.**
  1410. Make sure ALL of the following are true before setting this (assuming the
  1411. values from the example above):
  1412. * Your Django app is behind a proxy.
  1413. * Your proxy strips the ``X-Forwarded-Proto`` header from all incoming
  1414. requests. In other words, if end users include that header in their
  1415. requests, the proxy will discard it.
  1416. * Your proxy sets the ``X-Forwarded-Proto`` header and sends it to Django,
  1417. but only for requests that originally come in via HTTPS.
  1418. If any of those are not true, you should keep this setting set to ``None``
  1419. and find another way of determining HTTPS, perhaps via custom middleware.
  1420. .. setting:: SECURE_REDIRECT_EXEMPT
  1421. SECURE_REDIRECT_EXEMPT
  1422. ----------------------
  1423. .. versionadded:: 1.8
  1424. Default: ``[]``
  1425. If a URL path matches a regular expression in this list, the request will not be
  1426. redirected to HTTPS. If :setting:`SECURE_SSL_REDIRECT` is ``False``, this
  1427. setting has no effect.
  1428. .. setting:: SECURE_SSL_HOST
  1429. SECURE_SSL_HOST
  1430. ---------------
  1431. .. versionadded:: 1.8
  1432. Default: ``None``
  1433. If a string (e.g. ``secure.example.com``), all SSL redirects will be directed
  1434. to this host rather than the originally-requested host
  1435. (e.g. ``www.example.com``). If :setting:`SECURE_SSL_REDIRECT` is ``False``, this
  1436. setting has no effect.
  1437. .. setting:: SECURE_SSL_REDIRECT
  1438. SECURE_SSL_REDIRECT
  1439. -------------------
  1440. .. versionadded:: 1.8
  1441. Default: ``False``.
  1442. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware`
  1443. :ref:`redirects <ssl-redirect>` all non-HTTPS requests to HTTPS (except for
  1444. those URLs matching a regular expression listed in
  1445. :setting:`SECURE_REDIRECT_EXEMPT`).
  1446. .. note::
  1447. If turning this to ``True`` causes infinite redirects, it probably means
  1448. your site is running behind a proxy and can't tell which requests are secure
  1449. and which are not. Your proxy likely sets a header to indicate secure
  1450. requests; you can correct the problem by finding out what that header is and
  1451. configuring the :setting:`SECURE_PROXY_SSL_HEADER` setting accordingly.
  1452. .. setting:: SERIALIZATION_MODULES
  1453. SERIALIZATION_MODULES
  1454. ---------------------
  1455. Default: Not defined.
  1456. A dictionary of modules containing serializer definitions (provided as
  1457. strings), keyed by a string identifier for that serialization type. For
  1458. example, to define a YAML serializer, use::
  1459. SERIALIZATION_MODULES = {'yaml': 'path.to.yaml_serializer'}
  1460. .. setting:: SERVER_EMAIL
  1461. SERVER_EMAIL
  1462. ------------
  1463. Default: ``'root@localhost'``
  1464. The email address that error messages come from, such as those sent to
  1465. :setting:`ADMINS` and :setting:`MANAGERS`.
  1466. .. admonition:: Why are my emails sent from a different address?
  1467. This address is used only for error messages. It is *not* the address that
  1468. regular email messages sent with :meth:`~django.core.mail.send_mail()`
  1469. come from; for that, see :setting:`DEFAULT_FROM_EMAIL`.
  1470. .. setting:: SHORT_DATE_FORMAT
  1471. SHORT_DATE_FORMAT
  1472. -----------------
  1473. Default: ``m/d/Y`` (e.g. ``12/31/2003``)
  1474. An available formatting that can be used for displaying date fields on
  1475. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1476. corresponding locale-dictated format has higher precedence and will be applied.
  1477. See :tfilter:`allowed date format strings <date>`.
  1478. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  1479. .. setting:: SHORT_DATETIME_FORMAT
  1480. SHORT_DATETIME_FORMAT
  1481. ---------------------
  1482. Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
  1483. An available formatting that can be used for displaying datetime fields on
  1484. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1485. corresponding locale-dictated format has higher precedence and will be applied.
  1486. See :tfilter:`allowed date format strings <date>`.
  1487. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  1488. .. setting:: SIGNING_BACKEND
  1489. SIGNING_BACKEND
  1490. ---------------
  1491. Default: ``'django.core.signing.TimestampSigner'``
  1492. The backend used for signing cookies and other data.
  1493. See also the :doc:`/topics/signing` documentation.
  1494. .. setting:: SILENCED_SYSTEM_CHECKS
  1495. SILENCED_SYSTEM_CHECKS
  1496. ----------------------
  1497. .. versionadded:: 1.7
  1498. Default: ``[]``
  1499. A list of identifiers of messages generated by the system check framework
  1500. (i.e. ``["models.W001"]``) that you wish to permanently acknowledge and ignore.
  1501. Silenced warnings will no longer be output to the console; silenced errors
  1502. will still be printed, but will not prevent management commands from running.
  1503. See also the :doc:`/ref/checks` documentation.
  1504. .. setting:: TEMPLATES
  1505. TEMPLATES
  1506. ---------
  1507. .. versionadded:: 1.8
  1508. Default:: ``[]`` (Empty list)
  1509. A list containing the settings for all template engines to be used with
  1510. Django. Each item of the list is a dictionary containing the options for an
  1511. individual engine.
  1512. Here's a simple setup that tells the Django template engine to load templates
  1513. from the ``templates`` subdirectories inside installed applications::
  1514. TEMPLATES = [
  1515. {
  1516. 'BACKEND': 'django.template.backends.django.DjangoTemplates',
  1517. 'APP_DIRS': True,
  1518. },
  1519. ]
  1520. The following options are available for all backends.
  1521. .. setting:: TEMPLATES-BACKEND
  1522. BACKEND
  1523. ~~~~~~~
  1524. Default: not defined
  1525. The template backend to use. The built-in template backends are:
  1526. * ``'django.template.backends.django.DjangoTemplates'``
  1527. * ``'django.template.backends.jinja2.Jinja2'``
  1528. You can use a template backend that doesn't ship with Django by setting
  1529. ``BACKEND`` to a fully-qualified path (i.e. ``'mypackage.whatever.Backend'``).
  1530. .. setting:: TEMPLATES-NAME
  1531. NAME
  1532. ~~~~
  1533. Default: see below
  1534. The alias for this particular template engine. It's an identifier that allows
  1535. selecting an engine for rendering. Aliases must be unique across all
  1536. configured template engines.
  1537. It defaults to the name of the module defining the engine class, i.e. the
  1538. next to last piece of :setting:`BACKEND <TEMPLATES-BACKEND>`, when it isn't
  1539. provided. For example if the backend is ``'mypackage.whatever.Backend'`` then
  1540. its default name is ``'whatever'``.
  1541. .. setting:: TEMPLATES-DIRS
  1542. DIRS
  1543. ~~~~
  1544. Default:: ``[]`` (Empty list)
  1545. Directories where the engine should look for template source files, in search
  1546. order.
  1547. .. setting:: TEMPLATES-APP_DIRS
  1548. APP_DIRS
  1549. ~~~~~~~~
  1550. Default:: ``False``
  1551. Whether the engine should look for template source files inside installed
  1552. applications.
  1553. .. setting:: TEMPLATES-OPTIONS
  1554. OPTIONS
  1555. ~~~~~~~
  1556. Default:: ``{}`` (Empty dict)
  1557. Extra parameters to pass to the template backend. Available parameters vary
  1558. depending on the template backend.
  1559. .. setting:: TEMPLATE_CONTEXT_PROCESSORS
  1560. TEMPLATE_CONTEXT_PROCESSORS
  1561. ---------------------------
  1562. Default::
  1563. ("django.contrib.auth.context_processors.auth",
  1564. "django.template.context_processors.debug",
  1565. "django.template.context_processors.i18n",
  1566. "django.template.context_processors.media",
  1567. "django.template.context_processors.static",
  1568. "django.template.context_processors.tz",
  1569. "django.contrib.messages.context_processors.messages")
  1570. .. deprecated:: 1.8
  1571. Set the ``'context_processors'`` option in the :setting:`OPTIONS
  1572. <TEMPLATES-OPTIONS>` of a ``DjangoTemplates`` backend instead.
  1573. A tuple of callables that are used to populate the context in ``RequestContext``.
  1574. These callables take a request object as their argument and return a dictionary
  1575. of items to be merged into the context.
  1576. .. versionchanged:: 1.8
  1577. Built-in template context processors were moved from
  1578. ``django.core.context_processors`` to
  1579. ``django.template.context_processors`` in Django 1.8.
  1580. .. setting:: TEMPLATE_DEBUG
  1581. TEMPLATE_DEBUG
  1582. --------------
  1583. Default: ``False``
  1584. A boolean that turns on/off template debug mode. If this is ``True``, the fancy
  1585. error page will display a detailed report for any exception raised during
  1586. template rendering. This report contains the relevant snippet of the template,
  1587. with the appropriate line highlighted.
  1588. Note that Django only displays fancy error pages if :setting:`DEBUG` is ``True``, so
  1589. you'll want to set that to take advantage of this setting.
  1590. See also :setting:`DEBUG`.
  1591. .. setting:: TEMPLATE_DIRS
  1592. TEMPLATE_DIRS
  1593. -------------
  1594. Default: ``()`` (Empty tuple)
  1595. .. deprecated:: 1.8
  1596. Set the :setting:`DIRS <TEMPLATES-DIRS>` option of a ``DjangoTemplates``
  1597. backend instead.
  1598. List of locations of the template source files searched by
  1599. :class:`django.template.loaders.filesystem.Loader`, in search order.
  1600. Note that these paths should use Unix-style forward slashes, even on Windows.
  1601. See :doc:`/ref/templates/language`.
  1602. .. setting:: TEMPLATE_LOADERS
  1603. TEMPLATE_LOADERS
  1604. ----------------
  1605. Default::
  1606. ('django.template.loaders.filesystem.Loader',
  1607. 'django.template.loaders.app_directories.Loader')
  1608. .. deprecated:: 1.8
  1609. Set the ``'loaders'`` option in the :setting:`OPTIONS <TEMPLATES-OPTIONS>`
  1610. of a ``DjangoTemplates`` backend instead.
  1611. A tuple of template loader classes, specified as strings. Each ``Loader`` class
  1612. knows how to import templates from a particular source. Optionally, a tuple can be
  1613. used instead of a string. The first item in the tuple should be the ``Loader``’s
  1614. module, subsequent items are passed to the ``Loader`` during initialization. See
  1615. :doc:`/ref/templates/api`.
  1616. .. setting:: TEMPLATE_STRING_IF_INVALID
  1617. TEMPLATE_STRING_IF_INVALID
  1618. --------------------------
  1619. Default: ``''`` (Empty string)
  1620. .. deprecated:: 1.8
  1621. Set the ``'string_if_invalid'`` option in the :setting:`OPTIONS
  1622. <TEMPLATES-OPTIONS>` of a ``DjangoTemplates`` backend instead.
  1623. Output, as a string, that the template system should use for invalid (e.g.
  1624. misspelled) variables. See :ref:`invalid-template-variables`.
  1625. .. setting:: TEST_RUNNER
  1626. TEST_RUNNER
  1627. -----------
  1628. Default: ``'django.test.runner.DiscoverRunner'``
  1629. The name of the class to use for starting the test suite. See
  1630. :ref:`other-testing-frameworks`.
  1631. .. setting:: TEST_NON_SERIALIZED_APPS
  1632. TEST_NON_SERIALIZED_APPS
  1633. ------------------------
  1634. .. versionadded:: 1.7
  1635. Default: ``[]``
  1636. In order to restore the database state between tests for
  1637. ``TransactionTestCase``\s and database backends without transactions, Django
  1638. will :ref:`serialize the contents of all apps with migrations
  1639. <test-case-serialized-rollback>` when it starts the test run so it can then
  1640. reload from that copy before tests that need it.
  1641. This slows down the startup time of the test runner; if you have apps that
  1642. you know don't need this feature, you can add their full names in here (e.g.
  1643. ``'django.contrib.contenttypes'``) to exclude them from this serialization
  1644. process.
  1645. .. setting:: THOUSAND_SEPARATOR
  1646. THOUSAND_SEPARATOR
  1647. ------------------
  1648. Default: ``,`` (Comma)
  1649. Default thousand separator used when formatting numbers. This setting is
  1650. used only when :setting:`USE_THOUSAND_SEPARATOR` is ``True`` and
  1651. :setting:`NUMBER_GROUPING` is greater than ``0``.
  1652. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  1653. format has higher precedence and will be applied instead.
  1654. See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and
  1655. :setting:`USE_THOUSAND_SEPARATOR`.
  1656. .. setting:: TIME_FORMAT
  1657. TIME_FORMAT
  1658. -----------
  1659. Default: ``'P'`` (e.g. ``4 p.m.``)
  1660. The default formatting to use for displaying time fields in any part of the
  1661. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1662. locale-dictated format has higher precedence and will be applied instead. See
  1663. :tfilter:`allowed date format strings <date>`.
  1664. See also :setting:`DATE_FORMAT` and :setting:`DATETIME_FORMAT`.
  1665. .. setting:: TIME_INPUT_FORMATS
  1666. TIME_INPUT_FORMATS
  1667. ------------------
  1668. Default::
  1669. (
  1670. '%H:%M:%S', # '14:30:59'
  1671. '%H:%M:%S.%f', # '14:30:59.000200'
  1672. '%H:%M', # '14:30'
  1673. )
  1674. A tuple of formats that will be accepted when inputting data on a time field.
  1675. Formats will be tried in order, using the first valid one. Note that these
  1676. format strings use Python's datetime_ module syntax, not the format strings
  1677. from the ``date`` Django template tag.
  1678. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  1679. precedence and will be applied instead.
  1680. See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`.
  1681. .. _datetime: https://docs.python.org/library/datetime.html#strftime-strptime-behavior
  1682. .. setting:: TIME_ZONE
  1683. TIME_ZONE
  1684. ---------
  1685. Default: ``'America/Chicago'``
  1686. A string representing the time zone for this installation, or ``None``. See
  1687. the `list of time zones`_.
  1688. .. note::
  1689. Since Django was first released with the :setting:`TIME_ZONE` set to
  1690. ``'America/Chicago'``, the global setting (used if nothing is defined in
  1691. your project's ``settings.py``) remains ``'America/Chicago'`` for backwards
  1692. compatibility. New project templates default to ``'UTC'``.
  1693. Note that this isn't necessarily the time zone of the server. For example, one
  1694. server may serve multiple Django-powered sites, each with a separate time zone
  1695. setting.
  1696. When :setting:`USE_TZ` is ``False``, this is the time zone in which Django
  1697. will store all datetimes. When :setting:`USE_TZ` is ``True``, this is the
  1698. default time zone that Django will use to display datetimes in templates and
  1699. to interpret datetimes entered in forms.
  1700. Django sets the ``os.environ['TZ']`` variable to the time zone you specify in
  1701. the :setting:`TIME_ZONE` setting. Thus, all your views and models will
  1702. automatically operate in this time zone. However, Django won't set the ``TZ``
  1703. environment variable under the following conditions:
  1704. * If you're using the manual configuration option as described in
  1705. :ref:`manually configuring settings
  1706. <settings-without-django-settings-module>`, or
  1707. * If you specify ``TIME_ZONE = None``. This will cause Django to fall back to
  1708. using the system timezone. However, this is discouraged when :setting:`USE_TZ
  1709. = True <USE_TZ>`, because it makes conversions between local time and UTC
  1710. less reliable.
  1711. If Django doesn't set the ``TZ`` environment variable, it's up to you
  1712. to ensure your processes are running in the correct environment.
  1713. .. note::
  1714. Django cannot reliably use alternate time zones in a Windows environment.
  1715. If you're running Django on Windows, :setting:`TIME_ZONE` must be set to
  1716. match the system time zone.
  1717. .. _list of time zones: http://en.wikipedia.org/wiki/List_of_tz_database_time_zones
  1718. .. _pytz: http://pytz.sourceforge.net/
  1719. .. setting:: USE_ETAGS
  1720. USE_ETAGS
  1721. ---------
  1722. Default: ``False``
  1723. A boolean that specifies whether to output the "Etag" header. This saves
  1724. bandwidth but slows down performance. This is used by the ``CommonMiddleware``
  1725. (see :doc:`/topics/http/middleware`) and in the``Cache Framework``
  1726. (see :doc:`/topics/cache`).
  1727. .. setting:: USE_I18N
  1728. USE_I18N
  1729. --------
  1730. Default: ``True``
  1731. A boolean that specifies whether Django's translation system should be enabled.
  1732. This provides an easy way to turn it off, for performance. If this is set to
  1733. ``False``, Django will make some optimizations so as not to load the
  1734. translation machinery.
  1735. See also :setting:`LANGUAGE_CODE`, :setting:`USE_L10N` and :setting:`USE_TZ`.
  1736. .. setting:: USE_L10N
  1737. USE_L10N
  1738. --------
  1739. Default: ``False``
  1740. A boolean that specifies if localized formatting of data will be enabled by
  1741. default or not. If this is set to ``True``, e.g. Django will display numbers and
  1742. dates using the format of the current locale.
  1743. See also :setting:`LANGUAGE_CODE`, :setting:`USE_I18N` and :setting:`USE_TZ`.
  1744. .. note::
  1745. The default :file:`settings.py` file created by :djadmin:`django-admin
  1746. startproject <startproject>` includes ``USE_L10N = True`` for convenience.
  1747. .. setting:: USE_THOUSAND_SEPARATOR
  1748. USE_THOUSAND_SEPARATOR
  1749. ----------------------
  1750. Default: ``False``
  1751. A boolean that specifies whether to display numbers using a thousand separator.
  1752. When :setting:`USE_L10N` is set to ``True`` and if this is also set to
  1753. ``True``, Django will use the values of :setting:`THOUSAND_SEPARATOR` and
  1754. :setting:`NUMBER_GROUPING` to format numbers.
  1755. See also :setting:`DECIMAL_SEPARATOR`, :setting:`NUMBER_GROUPING` and
  1756. :setting:`THOUSAND_SEPARATOR`.
  1757. .. setting:: USE_TZ
  1758. USE_TZ
  1759. ------
  1760. Default: ``False``
  1761. A boolean that specifies if datetimes will be timezone-aware by default or not.
  1762. If this is set to ``True``, Django will use timezone-aware datetimes internally.
  1763. Otherwise, Django will use naive datetimes in local time.
  1764. See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
  1765. .. note::
  1766. The default :file:`settings.py` file created by
  1767. :djadmin:`django-admin startproject <startproject>` includes
  1768. ``USE_TZ = True`` for convenience.
  1769. .. setting:: USE_X_FORWARDED_HOST
  1770. USE_X_FORWARDED_HOST
  1771. --------------------
  1772. Default: ``False``
  1773. A boolean that specifies whether to use the X-Forwarded-Host header in
  1774. preference to the Host header. This should only be enabled if a proxy
  1775. which sets this header is in use.
  1776. .. setting:: WSGI_APPLICATION
  1777. WSGI_APPLICATION
  1778. ----------------
  1779. Default: ``None``
  1780. The full Python path of the WSGI application object that Django's built-in
  1781. servers (e.g. :djadmin:`runserver`) will use. The :djadmin:`django-admin
  1782. startproject <startproject>` management command will create a simple
  1783. ``wsgi.py`` file with an ``application`` callable in it, and point this setting
  1784. to that ``application``.
  1785. If not set, the return value of ``django.core.wsgi.get_wsgi_application()``
  1786. will be used. In this case, the behavior of :djadmin:`runserver` will be
  1787. identical to previous Django versions.
  1788. .. setting:: YEAR_MONTH_FORMAT
  1789. YEAR_MONTH_FORMAT
  1790. -----------------
  1791. Default: ``'F Y'``
  1792. The default formatting to use for date fields on Django admin change-list
  1793. pages -- and, possibly, by other parts of the system -- in cases when only the
  1794. year and month are displayed.
  1795. For example, when a Django admin change-list page is being filtered by a date
  1796. drilldown, the header for a given month displays the month and the year.
  1797. Different locales have different formats. For example, U.S. English would say
  1798. "January 2006," whereas another locale might say "2006/January."
  1799. Note that if :setting:`USE_L10N` is set to ``True``, then the corresponding
  1800. locale-dictated format has higher precedence and will be applied.
  1801. See :tfilter:`allowed date format strings <date>`. See also
  1802. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT`
  1803. and :setting:`MONTH_DAY_FORMAT`.
  1804. .. setting:: X_FRAME_OPTIONS
  1805. X_FRAME_OPTIONS
  1806. ---------------
  1807. Default: ``'SAMEORIGIN'``
  1808. The default value for the X-Frame-Options header used by
  1809. :class:`~django.middleware.clickjacking.XFrameOptionsMiddleware`. See the
  1810. :doc:`clickjacking protection </ref/clickjacking/>` documentation.
  1811. Auth
  1812. ====
  1813. Settings for :mod:`django.contrib.auth`.
  1814. .. setting:: AUTHENTICATION_BACKENDS
  1815. AUTHENTICATION_BACKENDS
  1816. -----------------------
  1817. Default: ``('django.contrib.auth.backends.ModelBackend',)``
  1818. A tuple of authentication backend classes (as strings) to use when attempting to
  1819. authenticate a user. See the :ref:`authentication backends documentation
  1820. <authentication-backends>` for details.
  1821. .. setting:: AUTH_USER_MODEL
  1822. AUTH_USER_MODEL
  1823. ---------------
  1824. Default: 'auth.User'
  1825. The model to use to represent a User. See :ref:`auth-custom-user`.
  1826. .. warning::
  1827. You cannot change the AUTH_USER_MODEL setting during the lifetime of
  1828. a project (i.e. once you have made and migrated models that depend on it)
  1829. without serious effort. It is intended to be set at the project start,
  1830. and the model it refers to must be available in the first migration of
  1831. the app that it lives in.
  1832. See :ref:`auth-custom-user` for more details.
  1833. .. setting:: LOGIN_REDIRECT_URL
  1834. LOGIN_REDIRECT_URL
  1835. ------------------
  1836. Default: ``'/accounts/profile/'``
  1837. The URL where requests are redirected after login when the
  1838. ``contrib.auth.login`` view gets no ``next`` parameter.
  1839. This is used by the :func:`~django.contrib.auth.decorators.login_required`
  1840. decorator, for example.
  1841. This setting also accepts view function names and :ref:`named URL patterns
  1842. <naming-url-patterns>` which can be used to reduce configuration duplication
  1843. since you don't have to define the URL in two places (``settings`` and URLconf).
  1844. .. setting:: LOGIN_URL
  1845. LOGIN_URL
  1846. ---------
  1847. Default: ``'/accounts/login/'``
  1848. The URL where requests are redirected for login, especially when using the
  1849. :func:`~django.contrib.auth.decorators.login_required` decorator.
  1850. This setting also accepts view function names and :ref:`named URL patterns
  1851. <naming-url-patterns>` which can be used to reduce configuration duplication
  1852. since you don't have to define the URL in two places (``settings`` and URLconf).
  1853. .. setting:: LOGOUT_URL
  1854. LOGOUT_URL
  1855. ----------
  1856. Default: ``'/accounts/logout/'``
  1857. LOGIN_URL counterpart.
  1858. .. setting:: PASSWORD_RESET_TIMEOUT_DAYS
  1859. PASSWORD_RESET_TIMEOUT_DAYS
  1860. ---------------------------
  1861. Default: ``3``
  1862. The number of days a password reset link is valid for. Used by the
  1863. :mod:`django.contrib.auth` password reset mechanism.
  1864. .. setting:: PASSWORD_HASHERS
  1865. PASSWORD_HASHERS
  1866. ----------------
  1867. See :ref:`auth_password_storage`.
  1868. Default::
  1869. ('django.contrib.auth.hashers.PBKDF2PasswordHasher',
  1870. 'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
  1871. 'django.contrib.auth.hashers.BCryptPasswordHasher',
  1872. 'django.contrib.auth.hashers.SHA1PasswordHasher',
  1873. 'django.contrib.auth.hashers.MD5PasswordHasher',
  1874. 'django.contrib.auth.hashers.UnsaltedMD5PasswordHasher',
  1875. 'django.contrib.auth.hashers.CryptPasswordHasher')
  1876. .. _settings-messages:
  1877. Messages
  1878. ========
  1879. Settings for :mod:`django.contrib.messages`.
  1880. .. setting:: MESSAGE_LEVEL
  1881. MESSAGE_LEVEL
  1882. -------------
  1883. Default: ``messages.INFO``
  1884. Sets the minimum message level that will be recorded by the messages
  1885. framework. See :ref:`message levels <message-level>` for more details.
  1886. .. admonition:: Important
  1887. If you override ``MESSAGE_LEVEL`` in your settings file and rely on any of
  1888. the built-in constants, you must import the constants module directly to
  1889. avoid the potential for circular imports, e.g.::
  1890. from django.contrib.messages import constants as message_constants
  1891. MESSAGE_LEVEL = message_constants.DEBUG
  1892. If desired, you may specify the numeric values for the constants directly
  1893. according to the values in the above :ref:`constants table
  1894. <message-level-constants>`.
  1895. .. setting:: MESSAGE_STORAGE
  1896. MESSAGE_STORAGE
  1897. ---------------
  1898. Default: ``'django.contrib.messages.storage.fallback.FallbackStorage'``
  1899. Controls where Django stores message data. Valid values are:
  1900. * ``'django.contrib.messages.storage.fallback.FallbackStorage'``
  1901. * ``'django.contrib.messages.storage.session.SessionStorage'``
  1902. * ``'django.contrib.messages.storage.cookie.CookieStorage'``
  1903. See :ref:`message storage backends <message-storage-backends>` for more details.
  1904. The backends that use cookies --
  1905. :class:`~django.contrib.messages.storage.cookie.CookieStorage` and
  1906. :class:`~django.contrib.messages.storage.fallback.FallbackStorage` --
  1907. use the value of :setting:`SESSION_COOKIE_DOMAIN`, :setting:`SESSION_COOKIE_SECURE`
  1908. and :setting:`SESSION_COOKIE_HTTPONLY` when setting their cookies.
  1909. .. setting:: MESSAGE_TAGS
  1910. MESSAGE_TAGS
  1911. ------------
  1912. Default::
  1913. {messages.DEBUG: 'debug',
  1914. messages.INFO: 'info',
  1915. messages.SUCCESS: 'success',
  1916. messages.WARNING: 'warning',
  1917. messages.ERROR: 'error'}
  1918. This sets the mapping of message level to message tag, which is typically
  1919. rendered as a CSS class in HTML. If you specify a value, it will extend
  1920. the default. This means you only have to specify those values which you need
  1921. to override. See :ref:`message-displaying` above for more details.
  1922. .. admonition:: Important
  1923. If you override ``MESSAGE_TAGS`` in your settings file and rely on any of
  1924. the built-in constants, you must import the ``constants`` module directly to
  1925. avoid the potential for circular imports, e.g.::
  1926. from django.contrib.messages import constants as message_constants
  1927. MESSAGE_TAGS = {message_constants.INFO: ''}
  1928. If desired, you may specify the numeric values for the constants directly
  1929. according to the values in the above :ref:`constants table
  1930. <message-level-constants>`.
  1931. .. _settings-sessions:
  1932. Sessions
  1933. ========
  1934. Settings for :mod:`django.contrib.sessions`.
  1935. .. setting:: SESSION_CACHE_ALIAS
  1936. SESSION_CACHE_ALIAS
  1937. -------------------
  1938. Default: ``default``
  1939. If you're using :ref:`cache-based session storage <cached-sessions-backend>`,
  1940. this selects the cache to use.
  1941. .. setting:: SESSION_COOKIE_AGE
  1942. SESSION_COOKIE_AGE
  1943. ------------------
  1944. Default: ``1209600`` (2 weeks, in seconds)
  1945. The age of session cookies, in seconds.
  1946. .. setting:: SESSION_COOKIE_DOMAIN
  1947. SESSION_COOKIE_DOMAIN
  1948. ---------------------
  1949. Default: ``None``
  1950. The domain to use for session cookies. Set this to a string such as
  1951. ``".example.com"`` (note the leading dot!) for cross-domain cookies, or use
  1952. ``None`` for a standard domain cookie.
  1953. Be cautious when updating this setting on a production site. If you update
  1954. this setting to enable cross-domain cookies on a site that previously used
  1955. standard domain cookies, existing user cookies will be set to the old
  1956. domain. This may result in them being unable to log in as long as these cookies
  1957. persist.
  1958. This setting also affects cookies set by :mod:`django.contrib.messages`.
  1959. .. setting:: SESSION_COOKIE_HTTPONLY
  1960. SESSION_COOKIE_HTTPONLY
  1961. -----------------------
  1962. Default: ``True``
  1963. Whether to use ``HTTPOnly`` flag on the session cookie. If this is set to
  1964. ``True``, client-side JavaScript will not to be able to access the
  1965. session cookie.
  1966. HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It
  1967. is not part of the :rfc:`2109` standard for cookies, and it isn't honored
  1968. consistently by all browsers. However, when it is honored, it can be a
  1969. useful way to mitigate the risk of client side script accessing the
  1970. protected cookie data.
  1971. Turning it on makes it less trivial for an attacker to escalate a cross-site
  1972. scripting vulnerability into full hijacking of a user's session. There's not
  1973. much excuse for leaving this off, either: if your code depends on reading
  1974. session cookies from Javascript, you're probably doing it wrong.
  1975. .. versionadded:: 1.7
  1976. This setting also affects cookies set by :mod:`django.contrib.messages`.
  1977. .. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
  1978. .. setting:: SESSION_COOKIE_NAME
  1979. SESSION_COOKIE_NAME
  1980. -------------------
  1981. Default: ``'sessionid'``
  1982. The name of the cookie to use for sessions. This can be whatever you want (but
  1983. should be different from :setting:`LANGUAGE_COOKIE_NAME`).
  1984. .. setting:: SESSION_COOKIE_PATH
  1985. SESSION_COOKIE_PATH
  1986. -------------------
  1987. Default: ``'/'``
  1988. The path set on the session cookie. This should either match the URL path of your
  1989. Django installation or be parent of that path.
  1990. This is useful if you have multiple Django instances running under the same
  1991. hostname. They can use different cookie paths, and each instance will only see
  1992. its own session cookie.
  1993. .. setting:: SESSION_COOKIE_SECURE
  1994. SESSION_COOKIE_SECURE
  1995. ---------------------
  1996. Default: ``False``
  1997. Whether to use a secure cookie for the session cookie. If this is set to
  1998. ``True``, the cookie will be marked as "secure," which means browsers may
  1999. ensure that the cookie is only sent under an HTTPS connection.
  2000. Since it's trivial for a packet sniffer (e.g. `Firesheep`_) to hijack a user's
  2001. session if the session cookie is sent unencrypted, there's really no good
  2002. excuse to leave this off. It will prevent you from using sessions on insecure
  2003. requests and that's a good thing.
  2004. .. _Firesheep: http://codebutler.com/firesheep
  2005. .. versionadded:: 1.7
  2006. This setting also affects cookies set by :mod:`django.contrib.messages`.
  2007. .. setting:: SESSION_ENGINE
  2008. SESSION_ENGINE
  2009. --------------
  2010. Default: ``django.contrib.sessions.backends.db``
  2011. Controls where Django stores session data. Included engines are:
  2012. * ``'django.contrib.sessions.backends.db'``
  2013. * ``'django.contrib.sessions.backends.file'``
  2014. * ``'django.contrib.sessions.backends.cache'``
  2015. * ``'django.contrib.sessions.backends.cached_db'``
  2016. * ``'django.contrib.sessions.backends.signed_cookies'``
  2017. See :ref:`configuring-sessions` for more details.
  2018. .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
  2019. SESSION_EXPIRE_AT_BROWSER_CLOSE
  2020. -------------------------------
  2021. Default: ``False``
  2022. Whether to expire the session when the user closes their browser. See
  2023. :ref:`browser-length-vs-persistent-sessions`.
  2024. .. setting:: SESSION_FILE_PATH
  2025. SESSION_FILE_PATH
  2026. -----------------
  2027. Default: ``None``
  2028. If you're using file-based session storage, this sets the directory in
  2029. which Django will store session data. When the default value (``None``) is
  2030. used, Django will use the standard temporary directory for the system.
  2031. .. setting:: SESSION_SAVE_EVERY_REQUEST
  2032. SESSION_SAVE_EVERY_REQUEST
  2033. --------------------------
  2034. Default: ``False``
  2035. Whether to save the session data on every request. If this is ``False``
  2036. (default), then the session data will only be saved if it has been modified --
  2037. that is, if any of its dictionary values have been assigned or deleted.
  2038. .. setting:: SESSION_SERIALIZER
  2039. SESSION_SERIALIZER
  2040. ------------------
  2041. Default: ``'django.contrib.sessions.serializers.JSONSerializer'``
  2042. Full import path of a serializer class to use for serializing session data.
  2043. Included serializers are:
  2044. * ``'django.contrib.sessions.serializers.PickleSerializer'``
  2045. * ``'django.contrib.sessions.serializers.JSONSerializer'``
  2046. See :ref:`session_serialization` for details, including a warning regarding
  2047. possible remote code execution when using
  2048. :class:`~django.contrib.sessions.serializers.PickleSerializer`.
  2049. Sites
  2050. =====
  2051. Settings for :mod:`django.contrib.sites`.
  2052. .. setting:: SITE_ID
  2053. SITE_ID
  2054. -------
  2055. Default: Not defined
  2056. The ID, as an integer, of the current site in the ``django_site`` database
  2057. table. This is used so that application data can hook into specific sites
  2058. and a single database can manage content for multiple sites.
  2059. .. _settings-staticfiles:
  2060. Static files
  2061. ============
  2062. Settings for :mod:`django.contrib.staticfiles`.
  2063. .. setting:: STATIC_ROOT
  2064. STATIC_ROOT
  2065. -----------
  2066. Default: ``None``
  2067. The absolute path to the directory where :djadmin:`collectstatic` will collect
  2068. static files for deployment.
  2069. Example: ``"/var/www/example.com/static/"``
  2070. If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
  2071. (default) the :djadmin:`collectstatic` management command will collect static
  2072. files into this directory. See the howto on :doc:`managing static
  2073. files</howto/static-files/index>` for more details about usage.
  2074. .. warning::
  2075. This should be an (initially empty) destination directory for collecting
  2076. your static files from their permanent locations into one directory for
  2077. ease of deployment; it is **not** a place to store your static files
  2078. permanently. You should do that in directories that will be found by
  2079. :doc:`staticfiles</ref/contrib/staticfiles>`’s
  2080. :setting:`finders<STATICFILES_FINDERS>`, which by default, are
  2081. ``'static/'`` app sub-directories and any directories you include in
  2082. :setting:`STATICFILES_DIRS`).
  2083. .. setting:: STATIC_URL
  2084. STATIC_URL
  2085. ----------
  2086. Default: ``None``
  2087. URL to use when referring to static files located in :setting:`STATIC_ROOT`.
  2088. Example: ``"/static/"`` or ``"http://static.example.com/"``
  2089. If not ``None``, this will be used as the base path for
  2090. :ref:`asset definitions<form-asset-paths>` (the ``Media`` class) and the
  2091. :doc:`staticfiles app</ref/contrib/staticfiles>`.
  2092. It must end in a slash if set to a non-empty value.
  2093. You may need to :ref:`configure these files to be served in development
  2094. <serving-static-files-in-development>` and will definitely need to do so
  2095. :doc:`in production </howto/static-files/deployment>`.
  2096. .. setting:: STATICFILES_DIRS
  2097. STATICFILES_DIRS
  2098. ----------------
  2099. Default: ``[]``
  2100. This setting defines the additional locations the staticfiles app will traverse
  2101. if the ``FileSystemFinder`` finder is enabled, e.g. if you use the
  2102. :djadmin:`collectstatic` or :djadmin:`findstatic` management command or use the
  2103. static file serving view.
  2104. This should be set to a list or tuple of strings that contain full paths to
  2105. your additional files directory(ies) e.g.::
  2106. STATICFILES_DIRS = (
  2107. "/home/special.polls.com/polls/static",
  2108. "/home/polls.com/polls/static",
  2109. "/opt/webfiles/common",
  2110. )
  2111. Note that these paths should use Unix-style forward slashes, even on Windows
  2112. (e.g. ``"C:/Users/user/mysite/extra_static_content"``).
  2113. Prefixes (optional)
  2114. ~~~~~~~~~~~~~~~~~~~
  2115. In case you want to refer to files in one of the locations with an additional
  2116. namespace, you can **optionally** provide a prefix as ``(prefix, path)``
  2117. tuples, e.g.::
  2118. STATICFILES_DIRS = (
  2119. # ...
  2120. ("downloads", "/opt/webfiles/stats"),
  2121. )
  2122. For example, assuming you have :setting:`STATIC_URL` set to ``'/static/'``, the
  2123. :djadmin:`collectstatic` management command would collect the "stats" files
  2124. in a ``'downloads'`` subdirectory of :setting:`STATIC_ROOT`.
  2125. This would allow you to refer to the local file
  2126. ``'/opt/webfiles/stats/polls_20101022.tar.gz'`` with
  2127. ``'/static/downloads/polls_20101022.tar.gz'`` in your templates, e.g.:
  2128. .. code-block:: html+django
  2129. <a href="{% static "downloads/polls_20101022.tar.gz" %}">
  2130. .. setting:: STATICFILES_STORAGE
  2131. STATICFILES_STORAGE
  2132. -------------------
  2133. Default: ``'django.contrib.staticfiles.storage.StaticFilesStorage'``
  2134. The file storage engine to use when collecting static files with the
  2135. :djadmin:`collectstatic` management command.
  2136. A ready-to-use instance of the storage backend defined in this setting
  2137. can be found at ``django.contrib.staticfiles.storage.staticfiles_storage``.
  2138. For an example, see :ref:`staticfiles-from-cdn`.
  2139. .. setting:: STATICFILES_FINDERS
  2140. STATICFILES_FINDERS
  2141. -------------------
  2142. Default::
  2143. ("django.contrib.staticfiles.finders.FileSystemFinder",
  2144. "django.contrib.staticfiles.finders.AppDirectoriesFinder")
  2145. The list of finder backends that know how to find static files in
  2146. various locations.
  2147. The default will find files stored in the :setting:`STATICFILES_DIRS` setting
  2148. (using ``django.contrib.staticfiles.finders.FileSystemFinder``) and in a
  2149. ``static`` subdirectory of each app (using
  2150. ``django.contrib.staticfiles.finders.AppDirectoriesFinder``). If multiple
  2151. files with the same name are present, the first file that is found will be
  2152. used.
  2153. One finder is disabled by default:
  2154. ``django.contrib.staticfiles.finders.DefaultStorageFinder``. If added to
  2155. your :setting:`STATICFILES_FINDERS` setting, it will look for static files in
  2156. the default file storage as defined by the :setting:`DEFAULT_FILE_STORAGE`
  2157. setting.
  2158. .. note::
  2159. When using the ``AppDirectoriesFinder`` finder, make sure your apps
  2160. can be found by staticfiles. Simply add the app to the
  2161. :setting:`INSTALLED_APPS` setting of your site.
  2162. Static file finders are currently considered a private interface, and this
  2163. interface is thus undocumented.
  2164. Core Settings Topical Index
  2165. ===========================
  2166. Cache
  2167. -----
  2168. * :setting:`CACHES`
  2169. * :setting:`CACHE_MIDDLEWARE_ALIAS`
  2170. * :setting:`CACHE_MIDDLEWARE_KEY_PREFIX`
  2171. * :setting:`CACHE_MIDDLEWARE_SECONDS`
  2172. Database
  2173. --------
  2174. * :setting:`DATABASES`
  2175. * :setting:`DATABASE_ROUTERS`
  2176. * :setting:`DEFAULT_INDEX_TABLESPACE`
  2177. * :setting:`DEFAULT_TABLESPACE`
  2178. Debugging
  2179. ---------
  2180. * :setting:`DEBUG`
  2181. * :setting:`DEBUG_PROPAGATE_EXCEPTIONS`
  2182. Email
  2183. -----
  2184. * :setting:`ADMINS`
  2185. * :setting:`DEFAULT_CHARSET`
  2186. * :setting:`DEFAULT_FROM_EMAIL`
  2187. * :setting:`EMAIL_BACKEND`
  2188. * :setting:`EMAIL_FILE_PATH`
  2189. * :setting:`EMAIL_HOST`
  2190. * :setting:`EMAIL_HOST_PASSWORD`
  2191. * :setting:`EMAIL_HOST_USER`
  2192. * :setting:`EMAIL_PORT`
  2193. * :setting:`EMAIL_SSL_CERTFILE`
  2194. * :setting:`EMAIL_SSL_KEYFILE`
  2195. * :setting:`EMAIL_SUBJECT_PREFIX`
  2196. * :setting*`EMAIL_TIMEOUT`
  2197. * :setting:`EMAIL_USE_TLS`
  2198. * :setting:`MANAGERS`
  2199. * :setting:`SERVER_EMAIL`
  2200. Error reporting
  2201. ---------------
  2202. * :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER`
  2203. * :setting:`IGNORABLE_404_URLS`
  2204. * :setting:`MANAGERS`
  2205. * :setting:`SILENCED_SYSTEM_CHECKS`
  2206. .. _file-upload-settings:
  2207. File uploads
  2208. ------------
  2209. * :setting:`DEFAULT_FILE_STORAGE`
  2210. * :setting:`FILE_CHARSET`
  2211. * :setting:`FILE_UPLOAD_HANDLERS`
  2212. * :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`
  2213. * :setting:`FILE_UPLOAD_PERMISSIONS`
  2214. * :setting:`FILE_UPLOAD_TEMP_DIR`
  2215. * :setting:`MEDIA_ROOT`
  2216. * :setting:`MEDIA_URL`
  2217. Globalization (i18n/l10n)
  2218. -------------------------
  2219. * :setting:`DATE_FORMAT`
  2220. * :setting:`DATE_INPUT_FORMATS`
  2221. * :setting:`DATETIME_FORMAT`
  2222. * :setting:`DATETIME_INPUT_FORMATS`
  2223. * :setting:`DECIMAL_SEPARATOR`
  2224. * :setting:`FIRST_DAY_OF_WEEK`
  2225. * :setting:`FORMAT_MODULE_PATH`
  2226. * :setting:`LANGUAGE_CODE`
  2227. * :setting:`LANGUAGE_COOKIE_AGE`
  2228. * :setting:`LANGUAGE_COOKIE_DOMAIN`
  2229. * :setting:`LANGUAGE_COOKIE_NAME`
  2230. * :setting:`LANGUAGE_COOKIE_PATH`
  2231. * :setting:`LANGUAGES`
  2232. * :setting:`LOCALE_PATHS`
  2233. * :setting:`MONTH_DAY_FORMAT`
  2234. * :setting:`NUMBER_GROUPING`
  2235. * :setting:`SHORT_DATE_FORMAT`
  2236. * :setting:`SHORT_DATETIME_FORMAT`
  2237. * :setting:`THOUSAND_SEPARATOR`
  2238. * :setting:`TIME_FORMAT`
  2239. * :setting:`TIME_INPUT_FORMATS`
  2240. * :setting:`TIME_ZONE`
  2241. * :setting:`USE_I18N`
  2242. * :setting:`USE_L10N`
  2243. * :setting:`USE_THOUSAND_SEPARATOR`
  2244. * :setting:`USE_TZ`
  2245. * :setting:`YEAR_MONTH_FORMAT`
  2246. HTTP
  2247. ----
  2248. * :setting:`DEFAULT_CHARSET`
  2249. * :setting:`DEFAULT_CONTENT_TYPE`
  2250. * :setting:`DISALLOWED_USER_AGENTS`
  2251. * :setting:`FORCE_SCRIPT_NAME`
  2252. * :setting:`INTERNAL_IPS`
  2253. * :setting:`MIDDLEWARE_CLASSES`
  2254. * Security
  2255. * :setting:`SECURE_BROWSER_XSS_FILTER`
  2256. * :setting:`SECURE_CONTENT_TYPE_NOSNIFF`
  2257. * :setting:`SECURE_HSTS_INCLUDE_SUBDOMAINS`
  2258. * :setting:`SECURE_HSTS_SECONDS`
  2259. * :setting:`SECURE_PROXY_SSL_HEADER`
  2260. * :setting:`SECURE_REDIRECT_EXEMPT`
  2261. * :setting:`SECURE_SSL_HOST`
  2262. * :setting:`SECURE_SSL_REDIRECT`
  2263. * :setting:`SIGNING_BACKEND`
  2264. * :setting:`USE_ETAGS`
  2265. * :setting:`USE_X_FORWARDED_HOST`
  2266. * :setting:`WSGI_APPLICATION`
  2267. Logging
  2268. -------
  2269. * :setting:`LOGGING`
  2270. * :setting:`LOGGING_CONFIG`
  2271. Models
  2272. ------
  2273. * :setting:`ABSOLUTE_URL_OVERRIDES`
  2274. * :setting:`FIXTURE_DIRS`
  2275. * :setting:`INSTALLED_APPS`
  2276. Security
  2277. --------
  2278. * Cross Site Request Forgery protection
  2279. * :setting:`CSRF_COOKIE_DOMAIN`
  2280. * :setting:`CSRF_COOKIE_NAME`
  2281. * :setting:`CSRF_COOKIE_PATH`
  2282. * :setting:`CSRF_COOKIE_SECURE`
  2283. * :setting:`CSRF_FAILURE_VIEW`
  2284. * :setting:`SECRET_KEY`
  2285. * :setting:`X_FRAME_OPTIONS`
  2286. Serialization
  2287. -------------
  2288. * :setting:`DEFAULT_CHARSET`
  2289. * :setting:`SERIALIZATION_MODULES`
  2290. Templates
  2291. ---------
  2292. * :setting:`ALLOWED_INCLUDE_ROOTS`
  2293. * :setting:`TEMPLATES`
  2294. * :setting:`TEMPLATE_CONTEXT_PROCESSORS`
  2295. * :setting:`TEMPLATE_DEBUG`
  2296. * :setting:`TEMPLATE_DIRS`
  2297. * :setting:`TEMPLATE_LOADERS`
  2298. * :setting:`TEMPLATE_STRING_IF_INVALID`
  2299. Testing
  2300. -------
  2301. * Database: :setting:`TEST <DATABASE-TEST>`
  2302. * :setting:`TEST_NON_SERIALIZED_APPS`
  2303. * :setting:`TEST_RUNNER`
  2304. URLs
  2305. ----
  2306. * :setting:`APPEND_SLASH`
  2307. * :setting:`PREPEND_WWW`
  2308. * :setting:`ROOT_URLCONF`