settings.txt 99 KB

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