settings.txt 99 KB

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