settings.txt 115 KB

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