settings.txt 86 KB

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