settings.txt 95 KB

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