settings.txt 83 KB

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