settings.txt 63 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235
  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. Available settings
  13. ==================
  14. Here's a full list of all available settings, in alphabetical order, and their
  15. default values.
  16. .. setting:: ABSOLUTE_URL_OVERRIDES
  17. ABSOLUTE_URL_OVERRIDES
  18. ----------------------
  19. Default: ``{}`` (Empty dictionary)
  20. A dictionary mapping ``"app_label.model_name"`` strings to functions that take
  21. a model object and return its URL. This is a way of overriding
  22. ``get_absolute_url()`` methods on a per-installation basis. Example::
  23. ABSOLUTE_URL_OVERRIDES = {
  24. 'blogs.weblog': lambda o: "/blogs/%s/" % o.slug,
  25. 'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
  26. }
  27. Note that the model name used in this setting should be all lower-case, regardless
  28. of the case of the actual model class name.
  29. .. setting:: ADMIN_FOR
  30. ADMIN_FOR
  31. ---------
  32. Default: ``()`` (Empty tuple)
  33. Used for admin-site settings modules, this should be a tuple of settings
  34. modules (in the format ``'foo.bar.baz'``) for which this site is an admin.
  35. The admin site uses this in its automatically-introspected documentation of
  36. models, views and template tags.
  37. .. setting:: ADMINS
  38. ADMINS
  39. ------
  40. Default: ``()`` (Empty tuple)
  41. A tuple that lists people who get code error notifications. When
  42. ``DEBUG=False`` and a view raises an exception, Django will email these people
  43. with the full exception information. Each member of the tuple should be a tuple
  44. of (Full name, email address). Example::
  45. (('John', 'john@example.com'), ('Mary', 'mary@example.com'))
  46. Note that Django will email *all* of these people whenever an error happens.
  47. See :doc:`/howto/error-reporting` for more information.
  48. .. setting:: ALLOWED_INCLUDE_ROOTS
  49. ALLOWED_INCLUDE_ROOTS
  50. ---------------------
  51. Default: ``()`` (Empty tuple)
  52. A tuple of strings representing allowed prefixes for the ``{% ssi %}`` template
  53. tag. This is a security measure, so that template authors can't access files
  54. that they shouldn't be accessing.
  55. For example, if :setting:`ALLOWED_INCLUDE_ROOTS` is ``('/home/html', '/var/www')``,
  56. then ``{% ssi /home/html/foo.txt %}`` would work, but ``{% ssi /etc/passwd %}``
  57. wouldn't.
  58. .. setting:: APPEND_SLASH
  59. APPEND_SLASH
  60. ------------
  61. Default: ``True``
  62. When set to ``True``, if the request URL does not match any of the patterns
  63. in the URLconf and it doesn't end in a slash, an HTTP redirect is issued to the
  64. same URL with a slash appended. Note that the redirect may cause any data
  65. submitted in a POST request to be lost.
  66. The :setting:`APPEND_SLASH` setting is only used if
  67. :class:`~django.middleware.common.CommonMiddleware` is installed
  68. (see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`.
  69. .. setting:: AUTHENTICATION_BACKENDS
  70. AUTHENTICATION_BACKENDS
  71. -----------------------
  72. Default: ``('django.contrib.auth.backends.ModelBackend',)``
  73. A tuple of authentication backend classes (as strings) to use when attempting to
  74. authenticate a user. See the :doc:`authentication backends documentation
  75. </ref/authbackends>` for details.
  76. .. setting:: AUTH_PROFILE_MODULE
  77. AUTH_PROFILE_MODULE
  78. -------------------
  79. Default: Not defined
  80. The site-specific user profile model used by this site. See
  81. :ref:`auth-profiles`.
  82. .. setting:: CACHES
  83. CACHES
  84. ------
  85. Default::
  86. {
  87. 'default': {
  88. 'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
  89. }
  90. }
  91. A dictionary containing the settings for all caches to be used with
  92. Django. It is a nested dictionary whose contents maps cache aliases
  93. to a dictionary containing the options for an individual cache.
  94. The :setting:`CACHES` setting must configure a ``default`` cache;
  95. any number of additional caches may also be specified. If you
  96. are using a cache backend other than the local memory cache, or
  97. you need to define multiple caches, other options will be required.
  98. The following cache options are available.
  99. .. setting:: CACHES-BACKEND
  100. BACKEND
  101. ~~~~~~~
  102. Default: ``''`` (Empty string)
  103. The cache backend to use. The built-in cache backends are:
  104. * ``'django.core.cache.backends.db.DatabaseCache'``
  105. * ``'django.core.cache.backends.dummy.DummyCache'``
  106. * ``'django.core.cache.backends.filebased.FileBasedCache'``
  107. * ``'django.core.cache.backends.locmem.LocMemCache'``
  108. * ``'django.core.cache.backends.memcached.MemcachedCache'``
  109. * ``'django.core.cache.backends.memcached.PyLibMCCache'``
  110. You can use a cache backend that doesn't ship with Django by setting
  111. :setting:`BACKEND <CACHE-BACKEND>` to a fully-qualified path of a cache
  112. backend class (i.e. ``mypackage.backends.whatever.WhateverCache``).
  113. Writing a whole new cache backend from scratch is left as an exercise
  114. to the reader; see the other backends for examples.
  115. .. setting:: CACHES-KEY_FUNCTION
  116. KEY_FUNCTION
  117. ~~~~~~~~~~~~
  118. A string containing a dotted path to a function that defines how to
  119. compose a prefix, version and key into a final cache key. The default
  120. implementation is equivalent to the function::
  121. def make_key(key, key_prefix, version):
  122. return ':'.join([key_prefix, str(version), key])
  123. You may use any key function you want, as long as it has the same
  124. argument signature.
  125. See the :ref:`cache documentation <cache_key_transformation>` for more information.
  126. .. setting:: CACHES-KEY_PREFIX
  127. KEY_PREFIX
  128. ~~~~~~~~~~
  129. Default: ``''`` (Empty string)
  130. A string that will be automatically included (prepended by default) to
  131. all cache keys used by the Django server.
  132. See the :ref:`cache documentation <cache_key_prefixing>` for more information.
  133. .. setting:: CACHES-LOCATION
  134. LOCATION
  135. ~~~~~~~~
  136. Default: ``''`` (Empty string)
  137. The location of the cache to use. This might be the directory for a
  138. file system cache, a host and port for a memcache server, or simply an
  139. identifying name for a local memory cache. e.g.::
  140. CACHES = {
  141. 'default': {
  142. 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
  143. 'LOCATION': '/var/tmp/django_cache',
  144. }
  145. }
  146. .. setting:: CACHES-OPTIONS
  147. OPTIONS
  148. ~~~~~~~
  149. Default: None
  150. Extra parameters to pass to the cache backend. Available parameters
  151. vary depending on your cache backend.
  152. Some information on available parameters can be found in the
  153. :doc:`Cache Backends </topics/cache>` documentation. For more information,
  154. consult your backend module's own documentation.
  155. .. setting:: CACHES-TIMEOUT
  156. TIMEOUT
  157. ~~~~~~~
  158. Default: 300
  159. The number of seconds before a cache entry is considered stale.
  160. .. setting:: CACHES-VERSION
  161. VERSION
  162. ~~~~~~~
  163. Default: ``1``
  164. The default version number for cache keys generated by the Django server.
  165. See the :ref:`cache documentation <cache_versioning>` for more information.
  166. .. setting:: CACHE_MIDDLEWARE_ALIAS
  167. CACHE_MIDDLEWARE_ALIAS
  168. ----------------------
  169. Default: ``default``
  170. The cache connection to use for the cache middleware.
  171. .. setting:: CACHE_MIDDLEWARE_ANONYMOUS_ONLY
  172. CACHE_MIDDLEWARE_ANONYMOUS_ONLY
  173. -------------------------------
  174. Default: ``False``
  175. If the value of this setting is ``True``, only anonymous requests (i.e., not
  176. those made by a logged-in user) will be cached. Otherwise, the middleware
  177. caches every page that doesn't have GET or POST parameters.
  178. If you set the value of this setting to ``True``, you should make sure you've
  179. activated ``AuthenticationMiddleware``.
  180. See :doc:`/topics/cache`.
  181. .. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
  182. CACHE_MIDDLEWARE_KEY_PREFIX
  183. ---------------------------
  184. Default: ``''`` (Empty string)
  185. The cache key prefix that the cache middleware should use.
  186. See :doc:`/topics/cache`.
  187. .. setting:: CACHE_MIDDLEWARE_SECONDS
  188. CACHE_MIDDLEWARE_SECONDS
  189. ------------------------
  190. Default: ``600``
  191. The default number of seconds to cache a page when the caching middleware or
  192. ``cache_page()`` decorator is used.
  193. See :doc:`/topics/cache`.
  194. .. setting:: CSRF_COOKIE_DOMAIN
  195. CSRF_COOKIE_DOMAIN
  196. ------------------
  197. Default: ``None``
  198. The domain to be used when setting the CSRF cookie. This can be useful for
  199. easily allowing cross-subdomain requests to be excluded from the normal cross
  200. site request forgery protection. It should be set to a string such as
  201. ``".example.com"`` to allow a POST request from a form on one subdomain to be
  202. accepted by accepted by a view served from another subdomain.
  203. Please note that the presence of this setting does not imply that Django's CSRF
  204. protection is safe from cross-subdomain attacks by default - please see the
  205. :ref:`CSRF limitations <csrf-limitations>` section.
  206. .. setting:: CSRF_COOKIE_NAME
  207. CSRF_COOKIE_NAME
  208. ----------------
  209. Default: ``'csrftoken'``
  210. The name of the cookie to use for the CSRF authentication token. This can be whatever you
  211. want. See :doc:`/ref/contrib/csrf`.
  212. .. setting:: CSRF_COOKIE_PATH
  213. CSRF_COOKIE_PATH
  214. ----------------
  215. .. versionadded:: 1.4
  216. Default: ``'/'``
  217. The path set on the CSRF cookie. This should either match the URL path of your
  218. Django installation or be a parent of that path.
  219. This is useful if you have multiple Django instances running under the same
  220. hostname. They can use different cookie paths, and each instance will only see
  221. its own CSRF cookie.
  222. .. setting:: CSRF_COOKIE_SECURE
  223. CSRF_COOKIE_SECURE
  224. ------------------
  225. .. versionadded:: 1.4
  226. Default: ``False``
  227. Whether to use a secure cookie for the CSRF cookie. If this is set to ``True``,
  228. the cookie will be marked as "secure," which means browsers may ensure that the
  229. cookie is only sent under an HTTPS connection.
  230. .. setting:: CSRF_FAILURE_VIEW
  231. CSRF_FAILURE_VIEW
  232. -----------------
  233. Default: ``'django.views.csrf.csrf_failure'``
  234. A dotted path to the view function to be used when an incoming request
  235. is rejected by the CSRF protection. The function should have this signature::
  236. def csrf_failure(request, reason="")
  237. where ``reason`` is a short message (intended for developers or logging, not for
  238. end users) indicating the reason the request was rejected. See
  239. :doc:`/ref/contrib/csrf`.
  240. .. setting:: DATABASES
  241. DATABASES
  242. ---------
  243. Default: ``{}`` (Empty dictionary)
  244. A dictionary containing the settings for all databases to be used with
  245. Django. It is a nested dictionary whose contents maps database aliases
  246. to a dictionary containing the options for an individual database.
  247. The :setting:`DATABASES` setting must configure a ``default`` database;
  248. any number of additional databases may also be specified.
  249. The simplest possible settings file is for a single-database setup using
  250. SQLite. This can be configured using the following::
  251. DATABASES = {
  252. 'default': {
  253. 'ENGINE': 'django.db.backends.sqlite3',
  254. 'NAME': 'mydatabase'
  255. }
  256. }
  257. For other database backends, or more complex SQLite configurations, other options
  258. will be required. The following inner options are available.
  259. .. setting:: DATABASE-ENGINE
  260. ENGINE
  261. ~~~~~~
  262. Default: ``''`` (Empty string)
  263. The database backend to use. The built-in database backends are:
  264. * ``'django.db.backends.postgresql_psycopg2'``
  265. * ``'django.db.backends.mysql'``
  266. * ``'django.db.backends.sqlite3'``
  267. * ``'django.db.backends.oracle'``
  268. You can use a database backend that doesn't ship with Django by setting
  269. ``ENGINE`` to a fully-qualified path (i.e.
  270. ``mypackage.backends.whatever``). Writing a whole new database backend from
  271. scratch is left as an exercise to the reader; see the other backends for
  272. examples.
  273. .. setting:: HOST
  274. HOST
  275. ~~~~
  276. Default: ``''`` (Empty string)
  277. Which host to use when connecting to the database. An empty string means
  278. localhost. Not used with SQLite.
  279. If this value starts with a forward slash (``'/'``) and you're using MySQL,
  280. MySQL will connect via a Unix socket to the specified socket. For example::
  281. "HOST": '/var/run/mysql'
  282. If you're using MySQL and this value *doesn't* start with a forward slash, then
  283. this value is assumed to be the host.
  284. If you're using PostgreSQL, an empty string means to use a Unix domain socket
  285. for the connection, rather than a network connection to localhost. If you
  286. explicitly need to use a TCP/IP connection on the local machine with
  287. PostgreSQL, specify ``localhost`` here.
  288. .. setting:: NAME
  289. NAME
  290. ~~~~
  291. Default: ``''`` (Empty string)
  292. The name of the database to use. For SQLite, it's the full path to the database
  293. file. When specifying the path, always use forward slashes, even on Windows
  294. (e.g. ``C:/homes/user/mysite/sqlite3.db``).
  295. .. setting:: OPTIONS
  296. OPTIONS
  297. ~~~~~~~
  298. Default: ``{}`` (Empty dictionary)
  299. Extra parameters to use when connecting to the database. Available parameters
  300. vary depending on your database backend.
  301. Some information on available parameters can be found in the
  302. :doc:`Database Backends </ref/databases>` documentation. For more information,
  303. consult your backend module's own documentation.
  304. .. setting:: PASSWORD
  305. PASSWORD
  306. ~~~~~~~~
  307. Default: ``''`` (Empty string)
  308. The password to use when connecting to the database. Not used with SQLite.
  309. .. setting:: PORT
  310. PORT
  311. ~~~~
  312. Default: ``''`` (Empty string)
  313. The port to use when connecting to the database. An empty string means the
  314. default port. Not used with SQLite.
  315. .. setting:: USER
  316. USER
  317. ~~~~
  318. Default: ``''`` (Empty string)
  319. The username to use when connecting to the database. Not used with SQLite.
  320. .. setting:: TEST_CHARSET
  321. TEST_CHARSET
  322. ~~~~~~~~~~~~
  323. Default: ``None``
  324. The character set encoding used to create the test database. The value of this
  325. string is passed directly through to the database, so its format is
  326. backend-specific.
  327. Supported for the PostgreSQL_ (``postgresql_psycopg2``) and MySQL_ (``mysql``)
  328. backends.
  329. .. _PostgreSQL: http://www.postgresql.org/docs/8.2/static/multibyte.html
  330. .. _MySQL: http://dev.mysql.com/doc/refman/5.0/en/charset-database.html
  331. .. setting:: TEST_COLLATION
  332. TEST_COLLATION
  333. ~~~~~~~~~~~~~~
  334. Default: ``None``
  335. The collation order to use when creating the test database. This value is
  336. passed directly to the backend, so its format is backend-specific.
  337. Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
  338. .. _MySQL manual: MySQL_
  339. .. setting:: TEST_DEPENDENCIES
  340. TEST_DEPENDENCIES
  341. ~~~~~~~~~~~~~~~~~
  342. Default: ``['default']``, for all databases other than ``default``,
  343. which has no dependencies.
  344. The creation-order dependencies of the database. See the documentation
  345. on :ref:`controlling the creation order of test databases
  346. <topics-testing-creation-dependencies>` for details.
  347. .. setting:: TEST_MIRROR
  348. TEST_MIRROR
  349. ~~~~~~~~~~~
  350. Default: ``None``
  351. The alias of the database that this database should mirror during
  352. testing.
  353. This setting exists to allow for testing of master/slave
  354. configurations of multiple databases. See the documentation on
  355. :ref:`testing master/slave configurations
  356. <topics-testing-masterslave>` for details.
  357. .. setting:: TEST_NAME
  358. TEST_NAME
  359. ~~~~~~~~~
  360. Default: ``None``
  361. The name of database to use when running the test suite.
  362. If the default value (``None``) is used with the SQLite database engine, the
  363. tests will use a memory resident database. For all other database engines the
  364. test database will use the name ``'test_' + DATABASE_NAME``.
  365. See :doc:`/topics/testing`.
  366. .. setting:: TEST_CREATE
  367. TEST_CREATE
  368. ~~~~~~~~~~~
  369. Default: ``True``
  370. This is an Oracle-specific setting.
  371. If it is set to ``False``, the test tablespaces won't be automatically created
  372. at the beginning of the tests and dropped at the end.
  373. .. setting:: TEST_USER
  374. TEST_USER
  375. ~~~~~~~~~
  376. Default: ``None``
  377. This is an Oracle-specific setting.
  378. The username to use when connecting to the Oracle database that will be used
  379. when running tests. If not provided, Django will use ``'test_' + USER``.
  380. .. setting:: TEST_USER_CREATE
  381. TEST_USER_CREATE
  382. ~~~~~~~~~~~~~~~~
  383. Default: ``True``
  384. This is an Oracle-specific setting.
  385. If it is set to ``False``, the test user won't be automatically created at the
  386. beginning of the tests and dropped at the end.
  387. .. setting:: TEST_PASSWD
  388. TEST_PASSWD
  389. ~~~~~~~~~~~
  390. Default: ``None``
  391. This is an Oracle-specific setting.
  392. The password to use when connecting to the Oracle database that will be used
  393. when running tests. If not provided, Django will use a hardcoded default value.
  394. .. setting:: TEST_TBLSPACE
  395. TEST_TBLSPACE
  396. ~~~~~~~~~~~~~
  397. Default: ``None``
  398. This is an Oracle-specific setting.
  399. The name of the tablespace that will be used when running tests. If not
  400. provided, Django will use ``'test_' + NAME``.
  401. .. setting:: TEST_TBLSPACE_TMP
  402. TEST_TBLSPACE_TMP
  403. ~~~~~~~~~~~~~~~~~
  404. Default: ``None``
  405. This is an Oracle-specific setting.
  406. The name of the temporary tablespace that will be used when running tests. If
  407. not provided, Django will use ``'test_' + NAME + '_temp'``.
  408. .. setting:: DATABASE_ROUTERS
  409. DATABASE_ROUTERS
  410. ----------------
  411. Default: ``[]`` (Empty list)
  412. The list of routers that will be used to determine which database
  413. to use when performing a database queries.
  414. See the documentation on :ref:`automatic database routing in multi
  415. database configurations <topics-db-multi-db-routing>`.
  416. .. setting:: DATE_FORMAT
  417. DATE_FORMAT
  418. -----------
  419. Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
  420. The default formatting to use for displaying date fields in any part of the
  421. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  422. locale-dictated format has higher precedence and will be applied instead. See
  423. :tfilter:`allowed date format strings <date>`.
  424. See also :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  425. .. setting:: DATE_INPUT_FORMATS
  426. DATE_INPUT_FORMATS
  427. ------------------
  428. Default::
  429. ('%Y-%m-%d', '%m/%d/%Y', '%m/%d/%y', '%b %d %Y',
  430. '%b %d, %Y', '%d %b %Y', '%d %b, %Y', '%B %d %Y',
  431. '%B %d, %Y', '%d %B %Y', '%d %B, %Y')
  432. A tuple of formats that will be accepted when inputting data on a date field.
  433. Formats will be tried in order, using the first valid one. Note that these
  434. format strings use Python's datetime_ module syntax, not the format strings
  435. from the ``date`` Django template tag.
  436. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  437. precedence and will be applied instead.
  438. See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  439. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  440. .. setting:: DATETIME_FORMAT
  441. DATETIME_FORMAT
  442. ---------------
  443. Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
  444. The default formatting to use for displaying datetime fields in any part of the
  445. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  446. locale-dictated format has higher precedence and will be applied instead. See
  447. :tfilter:`allowed date format strings <date>`.
  448. See also :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  449. .. setting:: DATETIME_INPUT_FORMATS
  450. DATETIME_INPUT_FORMATS
  451. ----------------------
  452. Default::
  453. ('%Y-%m-%d %H:%M:%S', '%Y-%m-%d %H:%M', '%Y-%m-%d',
  454. '%m/%d/%Y %H:%M:%S', '%m/%d/%Y %H:%M', '%m/%d/%Y',
  455. '%m/%d/%y %H:%M:%S', '%m/%d/%y %H:%M', '%m/%d/%y')
  456. A tuple of formats that will be accepted when inputting data on a datetime
  457. field. Formats will be tried in order, using the first valid one. Note that
  458. these format strings use Python's datetime_ module syntax, not the format
  459. strings from the ``date`` Django template tag.
  460. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  461. precedence and will be applied instead.
  462. See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
  463. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  464. .. setting:: DEBUG
  465. DEBUG
  466. -----
  467. Default: ``False``
  468. A boolean that turns on/off debug mode.
  469. Never deploy a site into production with :setting:`DEBUG` turned on.
  470. Did you catch that? NEVER deploy a site into production with :setting:`DEBUG`
  471. turned on.
  472. One of the main features of debug mode is the display of detailed error pages.
  473. If your app raises an exception when :setting:`DEBUG` is ``True``, Django will
  474. display a detailed traceback, including a lot of metadata about your
  475. environment, such as all the currently defined Django settings (from
  476. ``settings.py``).
  477. As a security measure, Django will *not* include settings that might be
  478. sensitive (or offensive), such as :setting:`SECRET_KEY` or
  479. :setting:`PROFANITIES_LIST`. Specifically, it will exclude any setting whose
  480. name includes any of the following:
  481. * API
  482. * KEY
  483. * PASS
  484. * PROFANITIES_LIST
  485. * SECRET
  486. * SIGNATURE
  487. * TOKEN
  488. .. versionchanged:: 1.4
  489. We changed ``'PASSWORD'`` ``'PASS'``. ``'API'``, ``'TOKEN'`` and ``'KEY'``
  490. were added.
  491. Note that these are *partial* matches. ``'PASS'`` will also match PASSWORD,
  492. just as ``'TOKEN'`` will also match TOKENIZED and so on.
  493. Still, note that there are always going to be sections of your debug output
  494. that are inappropriate for public consumption. File paths, configuration
  495. options and the like all give attackers extra information about your server.
  496. It is also important to remember that when running with :setting:`DEBUG`
  497. turned on, Django will remember every SQL query it executes. This is useful
  498. when you're debugging, but it'll rapidly consume memory on a production server.
  499. .. _django/views/debug.py: https://github.com/django/django/blob/master/django/views/debug.py
  500. DEBUG_PROPAGATE_EXCEPTIONS
  501. --------------------------
  502. Default: ``False``
  503. If set to True, Django's normal exception handling of view functions
  504. will be suppressed, and exceptions will propagate upwards. This can
  505. be useful for some test setups, and should never be used on a live
  506. site.
  507. .. setting:: DECIMAL_SEPARATOR
  508. DECIMAL_SEPARATOR
  509. -----------------
  510. Default: ``'.'`` (Dot)
  511. Default decimal separator used when formatting decimal numbers.
  512. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  513. format has higher precedence and will be applied instead.
  514. See also :setting:`NUMBER_GROUPING`, :setting:`THOUSAND_SEPARATOR` and
  515. :setting:`USE_THOUSAND_SEPARATOR`.
  516. .. setting:: DEFAULT_CHARSET
  517. DEFAULT_CHARSET
  518. ---------------
  519. Default: ``'utf-8'``
  520. Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
  521. manually specified. Used with :setting:`DEFAULT_CONTENT_TYPE` to construct the
  522. ``Content-Type`` header.
  523. .. setting:: DEFAULT_CONTENT_TYPE
  524. DEFAULT_CONTENT_TYPE
  525. --------------------
  526. Default: ``'text/html'``
  527. Default content type to use for all ``HttpResponse`` objects, if a MIME type
  528. isn't manually specified. Used with :setting:`DEFAULT_CHARSET` to construct
  529. the ``Content-Type`` header.
  530. .. setting:: DEFAULT_EXCEPTION_REPORTER_FILTER
  531. DEFAULT_EXCEPTION_REPORTER_FILTER
  532. ---------------------------------
  533. Default: :class:`django.views.debug.SafeExceptionReporterFilter`
  534. Default exception reporter filter class to be used if none has been assigned to
  535. the :class:`HttpRequest` instance yet.
  536. See :ref:`Filtering error reports<filtering-error-reports>`.
  537. .. setting:: DEFAULT_FILE_STORAGE
  538. DEFAULT_FILE_STORAGE
  539. --------------------
  540. Default: :class:`django.core.files.storage.FileSystemStorage`
  541. Default file storage class to be used for any file-related operations that don't
  542. specify a particular storage system. See :doc:`/topics/files`.
  543. .. setting:: DEFAULT_FROM_EMAIL
  544. DEFAULT_FROM_EMAIL
  545. ------------------
  546. Default: ``'webmaster@localhost'``
  547. Default email address to use for various automated correspondence from the
  548. site manager(s).
  549. .. setting:: DEFAULT_INDEX_TABLESPACE
  550. DEFAULT_INDEX_TABLESPACE
  551. ------------------------
  552. Default: ``''`` (Empty string)
  553. Default tablespace to use for indexes on fields that don't specify
  554. one, if the backend supports it (see :doc:`/topics/db/tablespaces`).
  555. .. setting:: DEFAULT_TABLESPACE
  556. DEFAULT_TABLESPACE
  557. ------------------
  558. Default: ``''`` (Empty string)
  559. Default tablespace to use for models that don't specify one, if the
  560. backend supports it (see :doc:`/topics/db/tablespaces`).
  561. .. setting:: DISALLOWED_USER_AGENTS
  562. DISALLOWED_USER_AGENTS
  563. ----------------------
  564. Default: ``()`` (Empty tuple)
  565. List of compiled regular expression objects representing User-Agent strings that
  566. are not allowed to visit any page, systemwide. Use this for bad robots/crawlers.
  567. This is only used if ``CommonMiddleware`` is installed (see
  568. :doc:`/topics/http/middleware`).
  569. .. setting:: EMAIL_BACKEND
  570. EMAIL_BACKEND
  571. -------------
  572. Default: ``'django.core.mail.backends.smtp.EmailBackend'``
  573. The backend to use for sending emails. For the list of available backends see
  574. :doc:`/topics/email`.
  575. .. setting:: EMAIL_FILE_PATH
  576. EMAIL_FILE_PATH
  577. ---------------
  578. Default: Not defined
  579. The directory used by the ``file`` email backend to store output files.
  580. .. setting:: EMAIL_HOST
  581. EMAIL_HOST
  582. ----------
  583. Default: ``'localhost'``
  584. The host to use for sending email.
  585. See also :setting:`EMAIL_PORT`.
  586. .. setting:: EMAIL_HOST_PASSWORD
  587. EMAIL_HOST_PASSWORD
  588. -------------------
  589. Default: ``''`` (Empty string)
  590. Password to use for the SMTP server defined in :setting:`EMAIL_HOST`. This
  591. setting is used in conjunction with :setting:`EMAIL_HOST_USER` when
  592. authenticating to the SMTP server. If either of these settings is empty,
  593. Django won't attempt authentication.
  594. See also :setting:`EMAIL_HOST_USER`.
  595. .. setting:: EMAIL_HOST_USER
  596. EMAIL_HOST_USER
  597. ---------------
  598. Default: ``''`` (Empty string)
  599. Username to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  600. If empty, Django won't attempt authentication.
  601. See also :setting:`EMAIL_HOST_PASSWORD`.
  602. .. setting:: EMAIL_PORT
  603. EMAIL_PORT
  604. ----------
  605. Default: ``25``
  606. Port to use for the SMTP server defined in :setting:`EMAIL_HOST`.
  607. .. setting:: EMAIL_SUBJECT_PREFIX
  608. EMAIL_SUBJECT_PREFIX
  609. --------------------
  610. Default: ``'[Django] '``
  611. Subject-line prefix for email messages sent with ``django.core.mail.mail_admins``
  612. or ``django.core.mail.mail_managers``. You'll probably want to include the
  613. trailing space.
  614. .. setting:: EMAIL_USE_TLS
  615. EMAIL_USE_TLS
  616. -------------
  617. Default: ``False``
  618. Whether to use a TLS (secure) connection when talking to the SMTP server.
  619. .. setting:: FILE_CHARSET
  620. FILE_CHARSET
  621. ------------
  622. Default: ``'utf-8'``
  623. The character encoding used to decode any files read from disk. This includes
  624. template files and initial SQL data files.
  625. .. setting:: FILE_UPLOAD_HANDLERS
  626. FILE_UPLOAD_HANDLERS
  627. --------------------
  628. Default::
  629. ("django.core.files.uploadhandler.MemoryFileUploadHandler",
  630. "django.core.files.uploadhandler.TemporaryFileUploadHandler",)
  631. A tuple of handlers to use for uploading. See :doc:`/topics/files` for details.
  632. .. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
  633. FILE_UPLOAD_MAX_MEMORY_SIZE
  634. ---------------------------
  635. Default: ``2621440`` (i.e. 2.5 MB).
  636. The maximum size (in bytes) that an upload will be before it gets streamed to
  637. the file system. See :doc:`/topics/files` for details.
  638. .. setting:: FILE_UPLOAD_PERMISSIONS
  639. FILE_UPLOAD_PERMISSIONS
  640. -----------------------
  641. Default: ``None``
  642. The numeric mode (i.e. ``0644``) to set newly uploaded files to. For
  643. more information about what these modes mean, see the documentation for
  644. :func:`os.chmod`.
  645. If this isn't given or is ``None``, you'll get operating-system
  646. dependent behavior. On most platforms, temporary files will have a mode
  647. of ``0600``, and files saved from memory will be saved using the
  648. system's standard umask.
  649. .. warning::
  650. **Always prefix the mode with a 0.**
  651. If you're not familiar with file modes, please note that the leading
  652. ``0`` is very important: it indicates an octal number, which is the
  653. way that modes must be specified. If you try to use ``644``, you'll
  654. get totally incorrect behavior.
  655. .. setting:: FILE_UPLOAD_TEMP_DIR
  656. FILE_UPLOAD_TEMP_DIR
  657. --------------------
  658. Default: ``None``
  659. The directory to store data temporarily while uploading files. If ``None``,
  660. Django will use the standard temporary directory for the operating system. For
  661. example, this will default to '/tmp' on \*nix-style operating systems.
  662. See :doc:`/topics/files` for details.
  663. .. setting:: FIRST_DAY_OF_WEEK
  664. FIRST_DAY_OF_WEEK
  665. -----------------
  666. Default: ``0`` (Sunday)
  667. Number representing the first day of the week. This is especially useful
  668. when displaying a calendar. This value is only used when not using
  669. format internationalization, or when a format cannot be found for the
  670. current locale.
  671. The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
  672. Monday and so on.
  673. .. setting:: FIXTURE_DIRS
  674. FIXTURE_DIRS
  675. -------------
  676. Default: ``()`` (Empty tuple)
  677. List of directories searched for fixture files, in addition to the
  678. ``fixtures`` directory of each application, in search order.
  679. Note that these paths should use Unix-style forward slashes, even on Windows.
  680. See :ref:`initial-data-via-fixtures` and :ref:`topics-testing-fixtures`.
  681. FORCE_SCRIPT_NAME
  682. ------------------
  683. Default: ``None``
  684. If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
  685. environment variable in any HTTP request. This setting can be used to override
  686. the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
  687. of the preferred value or not supplied at all.
  688. .. setting:: FORMAT_MODULE_PATH
  689. FORMAT_MODULE_PATH
  690. ------------------
  691. Default: ``None``
  692. A full Python path to a Python package that contains format definitions for
  693. project locales. If not ``None``, Django will check for a ``formats.py``
  694. file, under the directory named as the current locale, and will use the
  695. formats defined on this file.
  696. For example, if :setting:`FORMAT_MODULE_PATH` is set to ``mysite.formats``,
  697. and current language is ``en`` (English), Django will expect a directory tree
  698. like::
  699. mysite/
  700. formats/
  701. __init__.py
  702. en/
  703. __init__.py
  704. formats.py
  705. Available formats are :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT`,
  706. :setting:`DATETIME_FORMAT`, :setting:`YEAR_MONTH_FORMAT`,
  707. :setting:`MONTH_DAY_FORMAT`, :setting:`SHORT_DATE_FORMAT`,
  708. :setting:`SHORT_DATETIME_FORMAT`, :setting:`FIRST_DAY_OF_WEEK`,
  709. :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  710. :setting:`NUMBER_GROUPING`.
  711. .. setting:: IGNORABLE_404_URLS
  712. IGNORABLE_404_URLS
  713. ------------------
  714. .. versionadded:: 1.4
  715. Default: ``()``
  716. List of compiled regular expression objects describing URLs that should be
  717. ignored when reporting HTTP 404 errors via email (see
  718. :doc:`/howto/error-reporting`). Use this if your site does not provide a
  719. commonly requested file such as ``favicon.ico`` or ``robots.txt``, or if it
  720. gets hammered by script kiddies.
  721. This is only used if :setting:`SEND_BROKEN_LINK_EMAILS` is set to ``True`` and
  722. ``CommonMiddleware`` is installed (see :doc:`/topics/http/middleware`).
  723. .. setting:: INSTALLED_APPS
  724. INSTALLED_APPS
  725. --------------
  726. Default: ``()`` (Empty tuple)
  727. A tuple of strings designating all applications that are enabled in this Django
  728. installation. Each string should be a full Python path to a Python package that
  729. contains a Django application, as created by :djadmin:`django-admin.py startapp
  730. <startapp>`.
  731. .. admonition:: App names must be unique
  732. The application names (that is, the final dotted part of the
  733. path to the module containing ``models.py``) defined in
  734. :setting:`INSTALLED_APPS` *must* be unique. For example, you can't
  735. include both ``django.contrib.auth`` and ``myproject.auth`` in
  736. INSTALLED_APPS.
  737. .. setting:: INTERNAL_IPS
  738. INTERNAL_IPS
  739. ------------
  740. Default: ``()`` (Empty tuple)
  741. A tuple of IP addresses, as strings, that:
  742. * See debug comments, when :setting:`DEBUG` is ``True``
  743. * Receive X headers if the ``XViewMiddleware`` is installed (see
  744. :doc:`/topics/http/middleware`)
  745. .. setting:: LANGUAGE_CODE
  746. LANGUAGE_CODE
  747. -------------
  748. Default: ``'en-us'``
  749. A string representing the language code for this installation. This should be in
  750. standard :term:`language format<language code>`. For example, U.S. English is
  751. ``"en-us"``. See :doc:`/topics/i18n/index`.
  752. .. setting:: LANGUAGE_COOKIE_NAME
  753. LANGUAGE_COOKIE_NAME
  754. --------------------
  755. Default: ``'django_language'``
  756. The name of the cookie to use for the language cookie. This can be whatever
  757. you want (but should be different from :setting:`SESSION_COOKIE_NAME`). See
  758. :doc:`/topics/i18n/index`.
  759. .. setting:: LANGUAGES
  760. LANGUAGES
  761. ---------
  762. Default: A tuple of all available languages. This list is continually growing
  763. and including a copy here would inevitably become rapidly out of date. You can
  764. see the current list of translated languages by looking in
  765. ``django/conf/global_settings.py`` (or view the `online source`_).
  766. .. _online source: https://github.com/django/django/blob/master/django/conf/global_settings.py
  767. The list is a tuple of two-tuples in the format ``(language code, language
  768. name)``, the ``language code`` part should be a
  769. :term:`language name<language code>` -- for example, ``('ja', 'Japanese')``.
  770. This specifies which languages are available for language selection. See
  771. :doc:`/topics/i18n/index`.
  772. Generally, the default value should suffice. Only set this setting if you want
  773. to restrict language selection to a subset of the Django-provided languages.
  774. If you define a custom :setting:`LANGUAGES` setting, it's OK to mark the
  775. languages as translation strings (as in the default value referred to above)
  776. -- but use a "dummy" ``gettext()`` function, not the one in
  777. ``django.utils.translation``. You should *never* import
  778. ``django.utils.translation`` from within your settings file, because that
  779. module in itself depends on the settings, and that would cause a circular
  780. import.
  781. The solution is to use a "dummy" ``gettext()`` function. Here's a sample
  782. settings file::
  783. gettext = lambda s: s
  784. LANGUAGES = (
  785. ('de', gettext('German')),
  786. ('en', gettext('English')),
  787. )
  788. With this arrangement, ``django-admin.py makemessages`` will still find and
  789. mark these strings for translation, but the translation won't happen at
  790. runtime -- so you'll have to remember to wrap the languages in the *real*
  791. ``gettext()`` in any code that uses :setting:`LANGUAGES` at runtime.
  792. .. setting:: LOCALE_PATHS
  793. LOCALE_PATHS
  794. ------------
  795. Default: ``()`` (Empty tuple)
  796. A tuple of directories where Django looks for translation files.
  797. See :ref:`how-django-discovers-translations`.
  798. Example::
  799. LOCALE_PATHS = (
  800. '/home/www/project/common_files/locale',
  801. '/var/local/translations/locale'
  802. )
  803. Note that in the paths you add to the value of this setting, if you have the
  804. typical ``/path/to/locale/xx/LC_MESSAGES`` hierarchy, you should use the path to
  805. the ``locale`` directory (i.e. ``'/path/to/locale'``).
  806. .. setting:: LOGGING
  807. LOGGING
  808. -------
  809. Default: A logging configuration dictionary.
  810. A data structure containing configuration information. The contents of
  811. this data structure will be passed as the argument to the
  812. configuration method described in :setting:`LOGGING_CONFIG`.
  813. The default logging configuration passes HTTP 500 server errors to an
  814. email log handler; all other log messages are given to a NullHandler.
  815. .. setting:: LOGGING_CONFIG
  816. LOGGING_CONFIG
  817. --------------
  818. Default: ``'django.utils.log.dictConfig'``
  819. A path to a callable that will be used to configure logging in the
  820. Django project. Points at a instance of Python's `dictConfig`_
  821. configuration method by default.
  822. If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
  823. configuration process will be skipped.
  824. .. _dictConfig: http://docs.python.org/library/logging.config.html#configuration-dictionary-schema
  825. .. setting:: LOGIN_REDIRECT_URL
  826. LOGIN_REDIRECT_URL
  827. ------------------
  828. Default: ``'/accounts/profile/'``
  829. The URL where requests are redirected after login when the
  830. ``contrib.auth.login`` view gets no ``next`` parameter.
  831. This is used by the :func:`~django.contrib.auth.decorators.login_required`
  832. decorator, for example.
  833. .. versionchanged:: 1.5
  834. This setting now also accepts view function names and
  835. :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
  836. configuration duplication since you no longer have to define the URL in two
  837. places (``settings`` and URLconf).
  838. For backward compatibility reasons the default remains unchanged.
  839. .. setting:: LOGIN_URL
  840. LOGIN_URL
  841. ---------
  842. Default: ``'/accounts/login/'``
  843. The URL where requests are redirected for login, especially when using the
  844. :func:`~django.contrib.auth.decorators.login_required` decorator.
  845. .. versionchanged:: 1.5
  846. This setting now also accepts view function names and
  847. :ref:`named URL patterns <naming-url-patterns>` which can be used to reduce
  848. configuration duplication since you no longer have to define the URL in two
  849. places (``settings`` and URLconf).
  850. For backward compatibility reasons the default remains unchanged.
  851. .. setting:: LOGOUT_URL
  852. LOGOUT_URL
  853. ----------
  854. Default: ``'/accounts/logout/'``
  855. LOGIN_URL counterpart.
  856. .. setting:: MANAGERS
  857. MANAGERS
  858. --------
  859. Default: ``()`` (Empty tuple)
  860. A tuple in the same format as :setting:`ADMINS` that specifies who should get
  861. broken-link notifications when :setting:`SEND_BROKEN_LINK_EMAILS` is ``True``.
  862. .. setting:: MEDIA_ROOT
  863. MEDIA_ROOT
  864. ----------
  865. Default: ``''`` (Empty string)
  866. Absolute filesystem path to the directory that will hold :doc:`user-uploaded
  867. files </topics/files>`.
  868. Example: ``"/var/www/example.com/media/"``
  869. See also :setting:`MEDIA_URL`.
  870. .. setting:: MEDIA_URL
  871. MEDIA_URL
  872. ---------
  873. Default: ``''`` (Empty string)
  874. URL that handles the media served from :setting:`MEDIA_ROOT`, used
  875. for :doc:`managing stored files </topics/files>`. It must end in a slash if set
  876. to a non-empty value.
  877. Example: ``"http://media.example.com/"``
  878. MESSAGE_LEVEL
  879. -------------
  880. Default: `messages.INFO`
  881. Sets the minimum message level that will be recorded by the messages
  882. framework. See the :doc:`messages documentation </ref/contrib/messages>` for
  883. more details.
  884. MESSAGE_STORAGE
  885. ---------------
  886. Default: ``'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'``
  887. Controls where Django stores message data. See the
  888. :doc:`messages documentation </ref/contrib/messages>` for more details.
  889. MESSAGE_TAGS
  890. ------------
  891. Default::
  892. {messages.DEBUG: 'debug',
  893. messages.INFO: 'info',
  894. messages.SUCCESS: 'success',
  895. messages.WARNING: 'warning',
  896. messages.ERROR: 'error',}
  897. Sets the mapping of message levels to message tags. See the
  898. :doc:`messages documentation </ref/contrib/messages>` for more details.
  899. .. setting:: MIDDLEWARE_CLASSES
  900. MIDDLEWARE_CLASSES
  901. ------------------
  902. Default::
  903. ('django.middleware.common.CommonMiddleware',
  904. 'django.contrib.sessions.middleware.SessionMiddleware',
  905. 'django.middleware.csrf.CsrfViewMiddleware',
  906. 'django.contrib.auth.middleware.AuthenticationMiddleware',
  907. 'django.contrib.messages.middleware.MessageMiddleware',)
  908. A tuple of middleware classes to use. See :doc:`/topics/http/middleware`.
  909. .. setting:: MONTH_DAY_FORMAT
  910. MONTH_DAY_FORMAT
  911. ----------------
  912. Default: ``'F j'``
  913. The default formatting to use for date fields on Django admin change-list
  914. pages -- and, possibly, by other parts of the system -- in cases when only the
  915. month and day are displayed.
  916. For example, when a Django admin change-list page is being filtered by a date
  917. drilldown, the header for a given day displays the day and month. Different
  918. locales have different formats. For example, U.S. English would say
  919. "January 1," whereas Spanish might say "1 Enero."
  920. See :tfilter:`allowed date format strings <date>`. See also
  921. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`,
  922. :setting:`TIME_FORMAT` and :setting:`YEAR_MONTH_FORMAT`.
  923. .. setting:: NUMBER_GROUPING
  924. NUMBER_GROUPING
  925. ----------------
  926. Default: ``0``
  927. Number of digits grouped together on the integer part of a number.
  928. Common use is to display a thousand separator. If this setting is ``0``, then
  929. no grouping will be applied to the number. If this setting is greater than
  930. ``0``, then :setting:`THOUSAND_SEPARATOR` will be used as the separator between
  931. those groups.
  932. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  933. format has higher precedence and will be applied instead.
  934. See also :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
  935. :setting:`USE_THOUSAND_SEPARATOR`.
  936. .. setting:: PASSWORD_RESET_TIMEOUT_DAYS
  937. PASSWORD_RESET_TIMEOUT_DAYS
  938. ---------------------------
  939. Default: ``3``
  940. The number of days a password reset link is valid for. Used by the
  941. :mod:`django.contrib.auth` password reset mechanism.
  942. .. setting:: PREPEND_WWW
  943. PREPEND_WWW
  944. -----------
  945. Default: ``False``
  946. Whether to prepend the "www." subdomain to URLs that don't have it. This is only
  947. used if :class:`~django.middleware.common.CommonMiddleware` is installed
  948. (see :doc:`/topics/http/middleware`). See also :setting:`APPEND_SLASH`.
  949. .. setting:: PROFANITIES_LIST
  950. PROFANITIES_LIST
  951. ----------------
  952. Default: ``()`` (Empty tuple)
  953. A tuple of profanities, as strings, that will be forbidden in comments when
  954. :setting:`COMMENTS_ALLOW_PROFANITIES` is ``False``.
  955. .. setting:: RESTRUCTUREDTEXT_FILTER_SETTINGS
  956. RESTRUCTUREDTEXT_FILTER_SETTINGS
  957. --------------------------------
  958. Default: ``{}``
  959. A dictionary containing settings for the ``restructuredtext`` markup filter from
  960. the :doc:`django.contrib.markup application </ref/contrib/markup>`. They override
  961. the default writer settings. See the Docutils restructuredtext `writer settings
  962. docs`_ for details.
  963. .. _writer settings docs: http://docutils.sourceforge.net/docs/user/config.html#html4css1-writer
  964. .. setting:: ROOT_URLCONF
  965. ROOT_URLCONF
  966. ------------
  967. Default: Not defined
  968. A string representing the full Python import path to your root URLconf. For example:
  969. ``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
  970. setting the attribute ``urlconf`` on the incoming ``HttpRequest``
  971. object. See :ref:`how-django-processes-a-request` for details.
  972. .. setting:: SECRET_KEY
  973. SECRET_KEY
  974. ----------
  975. Default: ``''`` (Empty string)
  976. A secret key for a particular Django installation. This is used to provide
  977. :doc:`cryptographic signing </topics/signing>`, and should be set to a unique,
  978. unpredictable value.
  979. :djadmin:`django-admin.py startproject <startproject>` automatically adds a
  980. randomly-generated ``SECRET_KEY`` to each new project.
  981. .. warning::
  982. **Keep this value secret.**
  983. Running Django with a known :setting:`SECRET_KEY` defeats many of Django's
  984. security protections, and can lead to privilege escalation and remote code
  985. execution vulnerabilities.
  986. .. versionchanged:: 1.5
  987. Django will now refuse to start if :setting:`SECRET_KEY` is not set.
  988. .. setting:: SECURE_PROXY_SSL_HEADER
  989. SECURE_PROXY_SSL_HEADER
  990. -----------------------
  991. .. versionadded:: 1.4
  992. Default: ``None``
  993. A tuple representing a HTTP header/value combination that signifies a request
  994. is secure. This controls the behavior of the request object's ``is_secure()``
  995. method.
  996. This takes some explanation. By default, ``is_secure()`` is able to determine
  997. whether a request is secure by looking at whether the requested URL uses
  998. "https://". This is important for Django's CSRF protection, and may be used
  999. by your own code or third-party apps.
  1000. If your Django app is behind a proxy, though, the proxy may be "swallowing" the
  1001. fact that a request is HTTPS, using a non-HTTPS connection between the proxy
  1002. and Django. In this case, ``is_secure()`` would always return ``False`` -- even
  1003. for requests that were made via HTTPS by the end user.
  1004. In this situation, you'll want to configure your proxy to set a custom HTTP
  1005. header that tells Django whether the request came in via HTTPS, and you'll want
  1006. to set ``SECURE_PROXY_SSL_HEADER`` so that Django knows what header to look
  1007. for.
  1008. You'll need to set a tuple with two elements -- the name of the header to look
  1009. for and the required value. For example::
  1010. SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTOCOL', 'https')
  1011. Here, we're telling Django that we trust the ``X-Forwarded-Protocol`` header
  1012. that comes from our proxy, and any time its value is ``'https'``, then the
  1013. request is guaranteed to be secure (i.e., it originally came in via HTTPS).
  1014. Obviously, you should *only* set this setting if you control your proxy or
  1015. have some other guarantee that it sets/strips this header appropriately.
  1016. Note that the header needs to be in the format as used by ``request.META`` --
  1017. all caps and likely starting with ``HTTP_``. (Remember, Django automatically
  1018. adds ``'HTTP_'`` to the start of x-header names before making the header
  1019. available in ``request.META``.)
  1020. .. warning::
  1021. **You will probably open security holes in your site if you set this without knowing what you're doing. And if you fail to set it when you should. Seriously.**
  1022. Make sure ALL of the following are true before setting this (assuming the
  1023. values from the example above):
  1024. * Your Django app is behind a proxy.
  1025. * Your proxy strips the 'X-Forwarded-Protocol' header from all incoming
  1026. requests. In other words, if end users include that header in their
  1027. requests, the proxy will discard it.
  1028. * Your proxy sets the 'X-Forwarded-Protocol' header and sends it to Django,
  1029. but only for requests that originally come in via HTTPS.
  1030. If any of those are not true, you should keep this setting set to ``None``
  1031. and find another way of determining HTTPS, perhaps via custom middleware.
  1032. .. setting:: SEND_BROKEN_LINK_EMAILS
  1033. SEND_BROKEN_LINK_EMAILS
  1034. -----------------------
  1035. Default: ``False``
  1036. Whether to send an email to the :setting:`MANAGERS` each time somebody visits
  1037. a Django-powered page that is 404ed with a non-empty referer (i.e., a broken
  1038. link). This is only used if ``CommonMiddleware`` is installed (see
  1039. :doc:`/topics/http/middleware`). See also :setting:`IGNORABLE_404_URLS` and
  1040. :doc:`/howto/error-reporting`.
  1041. .. setting:: SERIALIZATION_MODULES
  1042. SERIALIZATION_MODULES
  1043. ---------------------
  1044. Default: Not defined.
  1045. A dictionary of modules containing serializer definitions (provided as
  1046. strings), keyed by a string identifier for that serialization type. For
  1047. example, to define a YAML serializer, use::
  1048. SERIALIZATION_MODULES = { 'yaml' : 'path.to.yaml_serializer' }
  1049. .. setting:: SERVER_EMAIL
  1050. SERVER_EMAIL
  1051. ------------
  1052. Default: ``'root@localhost'``
  1053. The email address that error messages come from, such as those sent to
  1054. :setting:`ADMINS` and :setting:`MANAGERS`.
  1055. .. setting:: SESSION_COOKIE_AGE
  1056. SESSION_COOKIE_AGE
  1057. ------------------
  1058. Default: ``1209600`` (2 weeks, in seconds)
  1059. The age of session cookies, in seconds. See :doc:`/topics/http/sessions`.
  1060. .. setting:: SESSION_COOKIE_DOMAIN
  1061. SESSION_COOKIE_DOMAIN
  1062. ---------------------
  1063. Default: ``None``
  1064. The domain to use for session cookies. Set this to a string such as
  1065. ``".example.com"`` for cross-domain cookies, or use ``None`` for a standard
  1066. domain cookie. See the :doc:`/topics/http/sessions`.
  1067. .. setting:: SESSION_COOKIE_HTTPONLY
  1068. SESSION_COOKIE_HTTPONLY
  1069. -----------------------
  1070. Default: ``True``
  1071. Whether to use HTTPOnly flag on the session cookie. If this is set to
  1072. ``True``, client-side JavaScript will not to be able to access the
  1073. session cookie.
  1074. HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It
  1075. is not part of the :rfc:`2109` standard for cookies, and it isn't honored
  1076. consistently by all browsers. However, when it is honored, it can be a
  1077. useful way to mitigate the risk of client side script accessing the
  1078. protected cookie data.
  1079. .. _HTTPOnly: https://www.owasp.org/index.php/HTTPOnly
  1080. .. versionchanged:: 1.4
  1081. The default value of the setting was changed from ``False`` to ``True``.
  1082. .. setting:: SESSION_COOKIE_NAME
  1083. SESSION_COOKIE_NAME
  1084. -------------------
  1085. Default: ``'sessionid'``
  1086. The name of the cookie to use for sessions. This can be whatever you want (but
  1087. should be different from :setting:`LANGUAGE_COOKIE_NAME`).
  1088. See the :doc:`/topics/http/sessions`.
  1089. .. setting:: SESSION_COOKIE_PATH
  1090. SESSION_COOKIE_PATH
  1091. -------------------
  1092. Default: ``'/'``
  1093. The path set on the session cookie. This should either match the URL path of your
  1094. Django installation or be parent of that path.
  1095. This is useful if you have multiple Django instances running under the same
  1096. hostname. They can use different cookie paths, and each instance will only see
  1097. its own session cookie.
  1098. .. setting:: SESSION_COOKIE_SECURE
  1099. SESSION_COOKIE_SECURE
  1100. ---------------------
  1101. Default: ``False``
  1102. Whether to use a secure cookie for the session cookie. If this is set to
  1103. ``True``, the cookie will be marked as "secure," which means browsers may
  1104. ensure that the cookie is only sent under an HTTPS connection.
  1105. See the :doc:`/topics/http/sessions`.
  1106. .. setting:: SESSION_ENGINE
  1107. SESSION_ENGINE
  1108. --------------
  1109. Default: ``django.contrib.sessions.backends.db``
  1110. Controls where Django stores session data. Valid values are:
  1111. * ``'django.contrib.sessions.backends.db'``
  1112. * ``'django.contrib.sessions.backends.file'``
  1113. * ``'django.contrib.sessions.backends.cache'``
  1114. * ``'django.contrib.sessions.backends.cached_db'``
  1115. * ``'django.contrib.sessions.backends.signed_cookies'``
  1116. See :doc:`/topics/http/sessions`.
  1117. .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
  1118. SESSION_EXPIRE_AT_BROWSER_CLOSE
  1119. -------------------------------
  1120. Default: ``False``
  1121. Whether to expire the session when the user closes his or her browser.
  1122. See the :doc:`/topics/http/sessions`.
  1123. .. setting:: SESSION_FILE_PATH
  1124. SESSION_FILE_PATH
  1125. -----------------
  1126. Default: ``None``
  1127. If you're using file-based session storage, this sets the directory in
  1128. which Django will store session data. See :doc:`/topics/http/sessions`. When
  1129. the default value (``None``) is used, Django will use the standard temporary
  1130. directory for the system.
  1131. .. setting:: SESSION_SAVE_EVERY_REQUEST
  1132. SESSION_SAVE_EVERY_REQUEST
  1133. --------------------------
  1134. Default: ``False``
  1135. Whether to save the session data on every request. See
  1136. :doc:`/topics/http/sessions`.
  1137. .. setting:: SHORT_DATE_FORMAT
  1138. SHORT_DATE_FORMAT
  1139. -----------------
  1140. Default: ``m/d/Y`` (e.g. ``12/31/2003``)
  1141. An available formatting that can be used for displaying date fields on
  1142. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1143. corresponding locale-dictated format has higher precedence and will be applied.
  1144. See :tfilter:`allowed date format strings <date>`.
  1145. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
  1146. .. setting:: SHORT_DATETIME_FORMAT
  1147. SHORT_DATETIME_FORMAT
  1148. ---------------------
  1149. Default: ``m/d/Y P`` (e.g. ``12/31/2003 4 p.m.``)
  1150. An available formatting that can be used for displaying datetime fields on
  1151. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1152. corresponding locale-dictated format has higher precedence and will be applied.
  1153. See :tfilter:`allowed date format strings <date>`.
  1154. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
  1155. .. setting:: SIGNING_BACKEND
  1156. SIGNING_BACKEND
  1157. ---------------
  1158. .. versionadded:: 1.4
  1159. Default: 'django.core.signing.TimestampSigner'
  1160. The backend used for signing cookies and other data.
  1161. See also the :doc:`/topics/signing` documentation.
  1162. .. setting:: SITE_ID
  1163. SITE_ID
  1164. -------
  1165. Default: Not defined
  1166. The ID, as an integer, of the current site in the ``django_site`` database
  1167. table. This is used so that application data can hook into specific site(s)
  1168. and a single database can manage content for multiple sites.
  1169. See :doc:`/ref/contrib/sites`.
  1170. .. _site framework docs: ../sites/
  1171. .. setting:: STATIC_ROOT
  1172. STATIC_ROOT
  1173. -----------
  1174. Default: ``''`` (Empty string)
  1175. The absolute path to the directory where :djadmin:`collectstatic` will collect
  1176. static files for deployment.
  1177. Example: ``"/var/www/example.com/static/"``
  1178. If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
  1179. (default) the :djadmin:`collectstatic` management command will collect static
  1180. files into this directory. See the howto on :doc:`managing static
  1181. files</howto/static-files>` for more details about usage.
  1182. .. warning::
  1183. This should be an (initially empty) destination directory for collecting
  1184. your static files from their permanent locations into one directory for
  1185. ease of deployment; it is **not** a place to store your static files
  1186. permanently. You should do that in directories that will be found by
  1187. :doc:`staticfiles</ref/contrib/staticfiles>`'s
  1188. :setting:`finders<STATICFILES_FINDERS>`, which by default, are
  1189. ``'static/'`` app sub-directories and any directories you include in
  1190. :setting:`STATICFILES_DIRS`).
  1191. See :doc:`staticfiles reference</ref/contrib/staticfiles>` and
  1192. :setting:`STATIC_URL`.
  1193. .. setting:: STATIC_URL
  1194. STATIC_URL
  1195. ----------
  1196. Default: ``None``
  1197. URL to use when referring to static files located in :setting:`STATIC_ROOT`.
  1198. Example: ``"/static/"`` or ``"http://static.example.com/"``
  1199. If not ``None``, this will be used as the base path for
  1200. :ref:`media definitions<form-media-paths>` and the
  1201. :doc:`staticfiles app</ref/contrib/staticfiles>`.
  1202. It must end in a slash if set to a non-empty value.
  1203. See :setting:`STATIC_ROOT`.
  1204. .. setting:: TEMPLATE_CONTEXT_PROCESSORS
  1205. TEMPLATE_CONTEXT_PROCESSORS
  1206. ---------------------------
  1207. Default::
  1208. ("django.contrib.auth.context_processors.auth",
  1209. "django.core.context_processors.debug",
  1210. "django.core.context_processors.i18n",
  1211. "django.core.context_processors.media",
  1212. "django.core.context_processors.static",
  1213. "django.core.context_processors.tz",
  1214. "django.contrib.messages.context_processors.messages")
  1215. A tuple of callables that are used to populate the context in ``RequestContext``.
  1216. These callables take a request object as their argument and return a dictionary
  1217. of items to be merged into the context.
  1218. .. versionadded:: 1.4
  1219. The ``django.core.context_processors.tz`` context processor
  1220. was added in this release.
  1221. .. setting:: TEMPLATE_DEBUG
  1222. TEMPLATE_DEBUG
  1223. --------------
  1224. Default: ``False``
  1225. A boolean that turns on/off template debug mode. If this is ``True``, the fancy
  1226. error page will display a detailed report for any exception raised during
  1227. template rendering. This report contains the relevant snippet of the template,
  1228. with the appropriate line highlighted.
  1229. Note that Django only displays fancy error pages if :setting:`DEBUG` is ``True``, so
  1230. you'll want to set that to take advantage of this setting.
  1231. See also :setting:`DEBUG`.
  1232. .. setting:: TEMPLATE_DIRS
  1233. TEMPLATE_DIRS
  1234. -------------
  1235. Default: ``()`` (Empty tuple)
  1236. List of locations of the template source files searched by
  1237. :class:`django.template.loaders.filesystem.Loader`, in search order.
  1238. Note that these paths should use Unix-style forward slashes, even on Windows.
  1239. See :doc:`/topics/templates`.
  1240. .. setting:: TEMPLATE_LOADERS
  1241. TEMPLATE_LOADERS
  1242. ----------------
  1243. Default::
  1244. ('django.template.loaders.filesystem.Loader',
  1245. 'django.template.loaders.app_directories.Loader')
  1246. A tuple of template loader classes, specified as strings. Each ``Loader`` class
  1247. knows how to import templates from a particular source. Optionally, a tuple can be
  1248. used instead of a string. The first item in the tuple should be the ``Loader``'s
  1249. module, subsequent items are passed to the ``Loader`` during initialization. See
  1250. :doc:`/ref/templates/api`.
  1251. .. setting:: TEMPLATE_STRING_IF_INVALID
  1252. TEMPLATE_STRING_IF_INVALID
  1253. --------------------------
  1254. Default: ``''`` (Empty string)
  1255. Output, as a string, that the template system should use for invalid (e.g.
  1256. misspelled) variables. See :ref:`invalid-template-variables`..
  1257. .. setting:: TEST_RUNNER
  1258. TEST_RUNNER
  1259. -----------
  1260. Default: ``'django.test.simple.DjangoTestSuiteRunner'``
  1261. The name of the class to use for starting the test suite. See
  1262. :doc:`/topics/testing`.
  1263. .. _Testing Django Applications: ../testing/
  1264. .. setting:: THOUSAND_SEPARATOR
  1265. THOUSAND_SEPARATOR
  1266. ------------------
  1267. Default: ``,`` (Comma)
  1268. Default thousand separator used when formatting numbers. This setting is
  1269. used only when :setting:`USE_THOUSAND_SEPARATOR` is ``True`` and
  1270. :setting:`NUMBER_GROUPING` is greater than ``0``.
  1271. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
  1272. format has higher precedence and will be applied instead.
  1273. See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and
  1274. :setting:`USE_THOUSAND_SEPARATOR`.
  1275. .. setting:: TIME_FORMAT
  1276. TIME_FORMAT
  1277. -----------
  1278. Default: ``'P'`` (e.g. ``4 p.m.``)
  1279. The default formatting to use for displaying time fields in any part of the
  1280. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
  1281. locale-dictated format has higher precedence and will be applied instead. See
  1282. :tfilter:`allowed date format strings <date>`.
  1283. See also :setting:`DATE_FORMAT` and :setting:`DATETIME_FORMAT`.
  1284. .. setting:: TIME_INPUT_FORMATS
  1285. TIME_INPUT_FORMATS
  1286. ------------------
  1287. Default: ``('%H:%M:%S', '%H:%M')``
  1288. A tuple of formats that will be accepted when inputting data on a time field.
  1289. Formats will be tried in order, using the first valid one. Note that these
  1290. format strings use Python's datetime_ module syntax, not the format strings
  1291. from the ``date`` Django template tag.
  1292. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
  1293. precedence and will be applied instead.
  1294. See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`.
  1295. .. _datetime: http://docs.python.org/library/datetime.html#strftime-strptime-behavior
  1296. .. setting:: TIME_ZONE
  1297. TIME_ZONE
  1298. ---------
  1299. Default: ``'America/Chicago'``
  1300. .. versionchanged:: 1.4
  1301. The meaning of this setting now depends on the value of :setting:`USE_TZ`.
  1302. A string representing the time zone for this installation, or
  1303. ``None``. `See available choices`_. (Note that list of available
  1304. choices lists more than one on the same line; you'll want to use just
  1305. one of the choices for a given time zone. For instance, one line says
  1306. ``'Europe/London GB GB-Eire'``, but you should use the first bit of
  1307. that -- ``'Europe/London'`` -- as your :setting:`TIME_ZONE` setting.)
  1308. Note that this isn't necessarily the time zone of the server. For example, one
  1309. server may serve multiple Django-powered sites, each with a separate time zone
  1310. setting.
  1311. When :setting:`USE_TZ` is ``False``, this is the time zone in which Django
  1312. will store all datetimes. When :setting:`USE_TZ` is ``True``, this is the
  1313. default time zone that Django will use to display datetimes in templates and
  1314. to interpret datetimes entered in forms.
  1315. Django sets the ``os.environ['TZ']`` variable to the time zone you specify in
  1316. the :setting:`TIME_ZONE` setting. Thus, all your views and models will
  1317. automatically operate in this time zone. However, Django won't set the ``TZ``
  1318. environment variable under the following conditions:
  1319. * If you're using the manual configuration option as described in
  1320. :ref:`manually configuring settings
  1321. <settings-without-django-settings-module>`, or
  1322. * If you specify ``TIME_ZONE = None``. This will cause Django to fall back to
  1323. using the system timezone. However, this is discouraged when :setting:`USE_TZ
  1324. = True <USE_TZ>`, because it makes conversions between local time and UTC
  1325. less reliable.
  1326. If Django doesn't set the ``TZ`` environment variable, it's up to you
  1327. to ensure your processes are running in the correct environment.
  1328. .. note::
  1329. Django cannot reliably use alternate time zones in a Windows environment.
  1330. If you're running Django on Windows, :setting:`TIME_ZONE` must be set to
  1331. match the system time zone.
  1332. .. _See available choices: http://www.postgresql.org/docs/8.1/static/datetime-keywords.html#DATETIME-TIMEZONE-SET-TABLE
  1333. .. _pytz: http://pytz.sourceforge.net/
  1334. .. setting:: USE_ETAGS
  1335. USE_ETAGS
  1336. ---------
  1337. Default: ``False``
  1338. A boolean that specifies whether to output the "Etag" header. This saves
  1339. bandwidth but slows down performance. This is used by the ``CommonMiddleware``
  1340. (see :doc:`/topics/http/middleware`) and in the``Cache Framework``
  1341. (see :doc:`/topics/cache`).
  1342. .. setting:: USE_I18N
  1343. USE_I18N
  1344. --------
  1345. Default: ``True``
  1346. A boolean that specifies whether Django's translation system should be enabled.
  1347. This provides an easy way to turn it off, for performance. If this is set to
  1348. ``False``, Django will make some optimizations so as not to load the
  1349. translation machinery.
  1350. See also :setting:`LANGUAGE_CODE`, :setting:`USE_L10N` and :setting:`USE_TZ`.
  1351. .. setting:: USE_L10N
  1352. USE_L10N
  1353. --------
  1354. Default: ``False``
  1355. A boolean that specifies if localized formatting of data will be enabled by
  1356. default or not. If this is set to ``True``, e.g. Django will display numbers and
  1357. dates using the format of the current locale.
  1358. See also :setting:`LANGUAGE_CODE`, :setting:`USE_I18N` and :setting:`USE_TZ`.
  1359. .. note::
  1360. The default :file:`settings.py` file created by :djadmin:`django-admin.py
  1361. startproject <startproject>` includes ``USE_L10N = True`` for convenience.
  1362. .. setting:: USE_THOUSAND_SEPARATOR
  1363. USE_THOUSAND_SEPARATOR
  1364. ----------------------
  1365. Default: ``False``
  1366. A boolean that specifies whether to display numbers using a thousand separator.
  1367. When :setting:`USE_L10N` is set to ``True`` and if this is also set to
  1368. ``True``, Django will use the values of :setting:`THOUSAND_SEPARATOR` and
  1369. :setting:`NUMBER_GROUPING` to format numbers.
  1370. See also :setting:`DECIMAL_SEPARATOR`, :setting:`NUMBER_GROUPING` and
  1371. :setting:`THOUSAND_SEPARATOR`.
  1372. .. setting:: USE_TZ
  1373. USE_TZ
  1374. ------
  1375. .. versionadded:: 1.4
  1376. Default: ``False``
  1377. A boolean that specifies if datetimes will be timezone-aware by default or not.
  1378. If this is set to ``True``, Django will use timezone-aware datetimes internally.
  1379. Otherwise, Django will use naive datetimes in local time.
  1380. See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
  1381. .. note::
  1382. The default :file:`settings.py` file created by
  1383. :djadmin:`django-admin.py startproject <startproject>` includes
  1384. ``USE_TZ = True`` for convenience.
  1385. .. setting:: USE_X_FORWARDED_HOST
  1386. USE_X_FORWARDED_HOST
  1387. --------------------
  1388. Default: ``False``
  1389. A boolean that specifies whether to use the X-Forwarded-Host header in
  1390. preference to the Host header. This should only be enabled if a proxy
  1391. which sets this header is in use.
  1392. .. setting:: WSGI_APPLICATION
  1393. WSGI_APPLICATION
  1394. ----------------
  1395. .. versionadded:: 1.4
  1396. Default: ``None``
  1397. The full Python path of the WSGI application object that Django's built-in
  1398. servers (e.g. :djadmin:`runserver`) will use. The :djadmin:`django-admin.py
  1399. startproject <startproject>` management command will create a simple
  1400. ``wsgi.py`` file with an ``application`` callable in it, and point this setting
  1401. to that ``application``.
  1402. If not set, the return value of :func:`django.core.wsgi.get_wsgi_application`
  1403. will be used. In this case, the behavior of :djadmin:`runserver` will be
  1404. identical to previous Django versions.
  1405. .. setting:: YEAR_MONTH_FORMAT
  1406. YEAR_MONTH_FORMAT
  1407. -----------------
  1408. Default: ``'F Y'``
  1409. The default formatting to use for date fields on Django admin change-list
  1410. pages -- and, possibly, by other parts of the system -- in cases when only the
  1411. year and month are displayed.
  1412. For example, when a Django admin change-list page is being filtered by a date
  1413. drilldown, the header for a given month displays the month and the year.
  1414. Different locales have different formats. For example, U.S. English would say
  1415. "January 2006," whereas another locale might say "2006/January."
  1416. See :tfilter:`allowed date format strings <date>`. See also
  1417. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT`
  1418. and :setting:`MONTH_DAY_FORMAT`.
  1419. .. setting:: X_FRAME_OPTIONS
  1420. X_FRAME_OPTIONS
  1421. ---------------
  1422. Default: ``'SAMEORIGIN'``
  1423. The default value for the X-Frame-Options header used by
  1424. :class:`~django.middleware.clickjacking.XFrameOptionsMiddleware`. See the
  1425. :doc:`clickjacking protection </ref/clickjacking/>` documentation.
  1426. Deprecated settings
  1427. ===================
  1428. .. setting:: ADMIN_MEDIA_PREFIX
  1429. ADMIN_MEDIA_PREFIX
  1430. ------------------
  1431. .. deprecated:: 1.4
  1432. This setting has been obsoleted by the ``django.contrib.staticfiles`` app
  1433. integration. See the :doc:`Django 1.4 release notes</releases/1.4>` for
  1434. more information.
  1435. .. setting:: IGNORABLE_404_ENDS
  1436. IGNORABLE_404_ENDS
  1437. ------------------
  1438. .. deprecated:: 1.4
  1439. This setting has been superseded by :setting:`IGNORABLE_404_URLS`.
  1440. .. setting:: IGNORABLE_404_STARTS
  1441. IGNORABLE_404_STARTS
  1442. --------------------
  1443. .. deprecated:: 1.4
  1444. This setting has been superseded by :setting:`IGNORABLE_404_URLS`.
  1445. .. setting:: URL_VALIDATOR_USER_AGENT
  1446. URL_VALIDATOR_USER_AGENT
  1447. ------------------------
  1448. .. deprecated:: 1.5
  1449. This value was used as the ``User-Agent`` header when checking if a URL
  1450. exists, a feature that was removed due to security and performance issues.