settings.txt 115 KB

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