settings.txt 96 KB

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