settings.txt 85 KB

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