settings.txt 99 KB

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