settings.txt 116 KB

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