settings.txt 65 KB

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