settings.txt 99 KB

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