1. ========
    
  2. Settings
    
  3. ========
    
  4. 
    
  5. .. contents::
    
  6.     :local:
    
  7.     :depth: 1
    
  8. 
    
  9. .. warning::
    
  10. 
    
  11.     Be careful when you override settings, especially when the default value
    
  12.     is a non-empty list or dictionary, such as :setting:`STATICFILES_FINDERS`.
    
  13.     Make sure you keep the components required by the features of Django you
    
  14.     wish to use.
    
  15. 
    
  16. Core Settings
    
  17. =============
    
  18. 
    
  19. Here's a list of settings available in Django core and their default values.
    
  20. Settings provided by contrib apps are listed below, followed by a topical index
    
  21. of the core settings. For introductory material, see the :doc:`settings topic
    
  22. guide </topics/settings>`.
    
  23. 
    
  24. .. setting:: ABSOLUTE_URL_OVERRIDES
    
  25. 
    
  26. ``ABSOLUTE_URL_OVERRIDES``
    
  27. --------------------------
    
  28. 
    
  29. Default: ``{}`` (Empty dictionary)
    
  30. 
    
  31. A dictionary mapping ``"app_label.model_name"`` strings to functions that take
    
  32. a model object and return its URL. This is a way of inserting or overriding
    
  33. ``get_absolute_url()`` methods on a per-installation basis. Example::
    
  34. 
    
  35.     ABSOLUTE_URL_OVERRIDES = {
    
  36.         'blogs.blog': lambda o: "/blogs/%s/" % o.slug,
    
  37.         'news.story': lambda o: "/stories/%s/%s/" % (o.pub_year, o.slug),
    
  38.     }
    
  39. 
    
  40. The model name used in this setting should be all lowercase, regardless of the
    
  41. case of the actual model class name.
    
  42. 
    
  43. .. setting:: ADMINS
    
  44. 
    
  45. ``ADMINS``
    
  46. ----------
    
  47. 
    
  48. Default: ``[]`` (Empty list)
    
  49. 
    
  50. A list of all the people who get code error notifications. When
    
  51. :setting:`DEBUG=False <DEBUG>` and :class:`~django.utils.log.AdminEmailHandler`
    
  52. is configured in :setting:`LOGGING` (done by default), Django emails these
    
  53. people the details of exceptions raised in the request/response cycle.
    
  54. 
    
  55. Each item in the list should be a tuple of (Full name, email address). Example::
    
  56. 
    
  57.     [('John', '[email protected]'), ('Mary', '[email protected]')]
    
  58. 
    
  59. .. setting:: ALLOWED_HOSTS
    
  60. 
    
  61. ``ALLOWED_HOSTS``
    
  62. -----------------
    
  63. 
    
  64. Default: ``[]`` (Empty list)
    
  65. 
    
  66. A list of strings representing the host/domain names that this Django site can
    
  67. serve. This is a security measure to prevent :ref:`HTTP Host header attacks
    
  68. <host-headers-virtual-hosting>`, which are possible even under many
    
  69. seemingly-safe web server configurations.
    
  70. 
    
  71. Values in this list can be fully qualified names (e.g. ``'www.example.com'``),
    
  72. in which case they will be matched against the request's ``Host`` header
    
  73. exactly (case-insensitive, not including port). A value beginning with a period
    
  74. can be used as a subdomain wildcard: ``'.example.com'`` will match
    
  75. ``example.com``, ``www.example.com``, and any other subdomain of
    
  76. ``example.com``. A value of ``'*'`` will match anything; in this case you are
    
  77. responsible to provide your own validation of the ``Host`` header (perhaps in a
    
  78. middleware; if so this middleware must be listed first in
    
  79. :setting:`MIDDLEWARE`).
    
  80. 
    
  81. Django also allows the `fully qualified domain name (FQDN)`_ of any entries.
    
  82. Some browsers include a trailing dot in the ``Host`` header which Django
    
  83. strips when performing host validation.
    
  84. 
    
  85. .. _`fully qualified domain name (FQDN)`: https://en.wikipedia.org/wiki/Fully_qualified_domain_name
    
  86. 
    
  87. If the ``Host`` header (or ``X-Forwarded-Host`` if
    
  88. :setting:`USE_X_FORWARDED_HOST` is enabled) does not match any value in this
    
  89. list, the :meth:`django.http.HttpRequest.get_host()` method will raise
    
  90. :exc:`~django.core.exceptions.SuspiciousOperation`.
    
  91. 
    
  92. When :setting:`DEBUG` is ``True`` and ``ALLOWED_HOSTS`` is empty, the host
    
  93. is validated against ``['.localhost', '127.0.0.1', '[::1]']``.
    
  94. 
    
  95. ``ALLOWED_HOSTS`` is also :ref:`checked when running tests
    
  96. <topics-testing-advanced-multiple-hosts>`.
    
  97. 
    
  98. This validation only applies via :meth:`~django.http.HttpRequest.get_host()`;
    
  99. if your code accesses the ``Host`` header directly from ``request.META`` you
    
  100. are bypassing this security protection.
    
  101. 
    
  102. .. setting:: APPEND_SLASH
    
  103. 
    
  104. ``APPEND_SLASH``
    
  105. ----------------
    
  106. 
    
  107. Default: ``True``
    
  108. 
    
  109. When set to ``True``, if the request URL does not match any of the patterns
    
  110. in the URLconf and it doesn't end in a slash, an HTTP redirect is issued to the
    
  111. same URL with a slash appended. Note that the redirect may cause any data
    
  112. submitted in a POST request to be lost.
    
  113. 
    
  114. The :setting:`APPEND_SLASH` setting is only used if
    
  115. :class:`~django.middleware.common.CommonMiddleware` is installed
    
  116. (see :doc:`/topics/http/middleware`). See also :setting:`PREPEND_WWW`.
    
  117. 
    
  118. .. setting:: CACHES
    
  119. 
    
  120. ``CACHES``
    
  121. ----------
    
  122. 
    
  123. Default::
    
  124. 
    
  125.     {
    
  126.         'default': {
    
  127.             'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
    
  128.         }
    
  129.     }
    
  130. 
    
  131. A dictionary containing the settings for all caches to be used with
    
  132. Django. It is a nested dictionary whose contents maps cache aliases
    
  133. to a dictionary containing the options for an individual cache.
    
  134. 
    
  135. The :setting:`CACHES` setting must configure a ``default`` cache;
    
  136. any number of additional caches may also be specified. If you
    
  137. are using a cache backend other than the local memory cache, or
    
  138. you need to define multiple caches, other options will be required.
    
  139. The following cache options are available.
    
  140. 
    
  141. .. setting:: CACHES-BACKEND
    
  142. 
    
  143. ``BACKEND``
    
  144. ~~~~~~~~~~~
    
  145. 
    
  146. Default: ``''`` (Empty string)
    
  147. 
    
  148. The cache backend to use. The built-in cache backends are:
    
  149. 
    
  150. * ``'django.core.cache.backends.db.DatabaseCache'``
    
  151. * ``'django.core.cache.backends.dummy.DummyCache'``
    
  152. * ``'django.core.cache.backends.filebased.FileBasedCache'``
    
  153. * ``'django.core.cache.backends.locmem.LocMemCache'``
    
  154. * ``'django.core.cache.backends.memcached.PyMemcacheCache'``
    
  155. * ``'django.core.cache.backends.memcached.PyLibMCCache'``
    
  156. * ``'django.core.cache.backends.redis.RedisCache'``
    
  157. 
    
  158. You can use a cache backend that doesn't ship with Django by setting
    
  159. :setting:`BACKEND <CACHES-BACKEND>` to a fully-qualified path of a cache
    
  160. backend class (i.e. ``mypackage.backends.whatever.WhateverCache``).
    
  161. 
    
  162. .. versionchanged:: 4.0
    
  163. 
    
  164.     The ``RedisCache`` backend was added.
    
  165. 
    
  166. .. setting:: CACHES-KEY_FUNCTION
    
  167. 
    
  168. ``KEY_FUNCTION``
    
  169. ~~~~~~~~~~~~~~~~
    
  170. 
    
  171. A string containing a dotted path to a function (or any callable) that defines how to
    
  172. compose a prefix, version and key into a final cache key. The default
    
  173. implementation is equivalent to the function::
    
  174. 
    
  175.     def make_key(key, key_prefix, version):
    
  176.         return ':'.join([key_prefix, str(version), key])
    
  177. 
    
  178. You may use any key function you want, as long as it has the same
    
  179. argument signature.
    
  180. 
    
  181. See the :ref:`cache documentation <cache_key_transformation>` for more
    
  182. information.
    
  183. 
    
  184. .. setting:: CACHES-KEY_PREFIX
    
  185. 
    
  186. ``KEY_PREFIX``
    
  187. ~~~~~~~~~~~~~~
    
  188. 
    
  189. Default: ``''`` (Empty string)
    
  190. 
    
  191. A string that will be automatically included (prepended by default) to
    
  192. all cache keys used by the Django server.
    
  193. 
    
  194. See the :ref:`cache documentation <cache_key_prefixing>` for more information.
    
  195. 
    
  196. .. setting:: CACHES-LOCATION
    
  197. 
    
  198. ``LOCATION``
    
  199. ~~~~~~~~~~~~
    
  200. 
    
  201. Default: ``''`` (Empty string)
    
  202. 
    
  203. The location of the cache to use. This might be the directory for a
    
  204. file system cache, a host and port for a memcache server, or an identifying
    
  205. name for a local memory cache. e.g.::
    
  206. 
    
  207.     CACHES = {
    
  208.         'default': {
    
  209.             'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache',
    
  210.             'LOCATION': '/var/tmp/django_cache',
    
  211.         }
    
  212.     }
    
  213. 
    
  214. .. setting:: CACHES-OPTIONS
    
  215. 
    
  216. ``OPTIONS``
    
  217. ~~~~~~~~~~~
    
  218. 
    
  219. Default: ``None``
    
  220. 
    
  221. Extra parameters to pass to the cache backend. Available parameters
    
  222. vary depending on your cache backend.
    
  223. 
    
  224. Some information on available parameters can be found in the
    
  225. :ref:`cache arguments <cache_arguments>` documentation. For more information,
    
  226. consult your backend module's own documentation.
    
  227. 
    
  228. .. setting:: CACHES-TIMEOUT
    
  229. 
    
  230. ``TIMEOUT``
    
  231. ~~~~~~~~~~~
    
  232. 
    
  233. Default: ``300``
    
  234. 
    
  235. The number of seconds before a cache entry is considered stale. If the value of
    
  236. this setting is ``None``, cache entries will not expire. A value of ``0``
    
  237. causes keys to immediately expire (effectively "don't cache").
    
  238. 
    
  239. .. setting:: CACHES-VERSION
    
  240. 
    
  241. ``VERSION``
    
  242. ~~~~~~~~~~~
    
  243. 
    
  244. Default: ``1``
    
  245. 
    
  246. The default version number for cache keys generated by the Django server.
    
  247. 
    
  248. See the :ref:`cache documentation <cache_versioning>` for more information.
    
  249. 
    
  250. .. setting:: CACHE_MIDDLEWARE_ALIAS
    
  251. 
    
  252. ``CACHE_MIDDLEWARE_ALIAS``
    
  253. --------------------------
    
  254. 
    
  255. Default: ``'default'``
    
  256. 
    
  257. The cache connection to use for the :ref:`cache middleware
    
  258. <the-per-site-cache>`.
    
  259. 
    
  260. .. setting:: CACHE_MIDDLEWARE_KEY_PREFIX
    
  261. 
    
  262. ``CACHE_MIDDLEWARE_KEY_PREFIX``
    
  263. -------------------------------
    
  264. 
    
  265. Default: ``''`` (Empty string)
    
  266. 
    
  267. A string which will be prefixed to the cache keys generated by the :ref:`cache
    
  268. middleware <the-per-site-cache>`. This prefix is combined with the
    
  269. :setting:`KEY_PREFIX <CACHES-KEY_PREFIX>` setting; it does not replace it.
    
  270. 
    
  271. See :doc:`/topics/cache`.
    
  272. 
    
  273. .. setting:: CACHE_MIDDLEWARE_SECONDS
    
  274. 
    
  275. ``CACHE_MIDDLEWARE_SECONDS``
    
  276. ----------------------------
    
  277. 
    
  278. Default: ``600``
    
  279. 
    
  280. The default number of seconds to cache a page for the :ref:`cache middleware
    
  281. <the-per-site-cache>`.
    
  282. 
    
  283. See :doc:`/topics/cache`.
    
  284. 
    
  285. .. _settings-csrf:
    
  286. 
    
  287. .. setting:: CSRF_COOKIE_AGE
    
  288. 
    
  289. ``CSRF_COOKIE_AGE``
    
  290. -------------------
    
  291. 
    
  292. Default: ``31449600`` (approximately 1 year, in seconds)
    
  293. 
    
  294. The age of CSRF cookies, in seconds.
    
  295. 
    
  296. The reason for setting a long-lived expiration time is to avoid problems in
    
  297. the case of a user closing a browser or bookmarking a page and then loading
    
  298. that page from a browser cache. Without persistent cookies, the form submission
    
  299. would fail in this case.
    
  300. 
    
  301. Some browsers (specifically Internet Explorer) can disallow the use of
    
  302. persistent cookies or can have the indexes to the cookie jar corrupted on disk,
    
  303. thereby causing CSRF protection checks to (sometimes intermittently) fail.
    
  304. Change this setting to ``None`` to use session-based CSRF cookies, which
    
  305. keep the cookies in-memory instead of on persistent storage.
    
  306. 
    
  307. .. setting:: CSRF_COOKIE_DOMAIN
    
  308. 
    
  309. ``CSRF_COOKIE_DOMAIN``
    
  310. ----------------------
    
  311. 
    
  312. Default: ``None``
    
  313. 
    
  314. The domain to be used when setting the CSRF cookie.  This can be useful for
    
  315. easily allowing cross-subdomain requests to be excluded from the normal cross
    
  316. site request forgery protection.  It should be set to a string such as
    
  317. ``".example.com"`` to allow a POST request from a form on one subdomain to be
    
  318. accepted by a view served from another subdomain.
    
  319. 
    
  320. Please note that the presence of this setting does not imply that Django's CSRF
    
  321. protection is safe from cross-subdomain attacks by default - please see the
    
  322. :ref:`CSRF limitations <csrf-limitations>` section.
    
  323. 
    
  324. .. setting:: CSRF_COOKIE_HTTPONLY
    
  325. 
    
  326. ``CSRF_COOKIE_HTTPONLY``
    
  327. ------------------------
    
  328. 
    
  329. Default: ``False``
    
  330. 
    
  331. Whether to use ``HttpOnly`` flag on the CSRF cookie. If this is set to
    
  332. ``True``, client-side JavaScript will not be able to access the CSRF cookie.
    
  333. 
    
  334. Designating the CSRF cookie as ``HttpOnly`` doesn't offer any practical
    
  335. protection because CSRF is only to protect against cross-domain attacks. If an
    
  336. attacker can read the cookie via JavaScript, they're already on the same domain
    
  337. as far as the browser knows, so they can do anything they like anyway. (XSS is
    
  338. a much bigger hole than CSRF.)
    
  339. 
    
  340. Although the setting offers little practical benefit, it's sometimes required
    
  341. by security auditors.
    
  342. 
    
  343. If you enable this and need to send the value of the CSRF token with an AJAX
    
  344. request, your JavaScript must pull the value :ref:`from a hidden CSRF token
    
  345. form input <acquiring-csrf-token-from-html>` instead of :ref:`from the cookie
    
  346. <acquiring-csrf-token-from-cookie>`.
    
  347. 
    
  348. See :setting:`SESSION_COOKIE_HTTPONLY` for details on ``HttpOnly``.
    
  349. 
    
  350. .. setting:: CSRF_COOKIE_MASKED
    
  351. 
    
  352. ``CSRF_COOKIE_MASKED``
    
  353. ----------------------
    
  354. 
    
  355. .. versionadded:: 4.1
    
  356. 
    
  357. Default: ``False``
    
  358. 
    
  359. Whether to mask the CSRF cookie. See
    
  360. :ref:`release notes <csrf-cookie-masked-usage>` for usage details.
    
  361. 
    
  362. .. deprecated:: 4.1
    
  363. 
    
  364.     This transitional setting is deprecated and will be removed in Django 5.0.
    
  365. 
    
  366. .. setting:: CSRF_COOKIE_NAME
    
  367. 
    
  368. ``CSRF_COOKIE_NAME``
    
  369. --------------------
    
  370. 
    
  371. Default: ``'csrftoken'``
    
  372. 
    
  373. The name of the cookie to use for the CSRF authentication token. This can be
    
  374. whatever you want (as long as it's different from the other cookie names in
    
  375. your application). See :doc:`/ref/csrf`.
    
  376. 
    
  377. .. setting:: CSRF_COOKIE_PATH
    
  378. 
    
  379. ``CSRF_COOKIE_PATH``
    
  380. --------------------
    
  381. 
    
  382. Default: ``'/'``
    
  383. 
    
  384. The path set on the CSRF cookie. This should either match the URL path of your
    
  385. Django installation or be a parent of that path.
    
  386. 
    
  387. This is useful if you have multiple Django instances running under the same
    
  388. hostname. They can use different cookie paths, and each instance will only see
    
  389. its own CSRF cookie.
    
  390. 
    
  391. .. setting:: CSRF_COOKIE_SAMESITE
    
  392. 
    
  393. ``CSRF_COOKIE_SAMESITE``
    
  394. ------------------------
    
  395. 
    
  396. Default: ``'Lax'``
    
  397. 
    
  398. The value of the `SameSite`_ flag on the CSRF cookie. This flag prevents the
    
  399. cookie from being sent in cross-site requests.
    
  400. 
    
  401. See :setting:`SESSION_COOKIE_SAMESITE` for details about ``SameSite``.
    
  402. 
    
  403. .. setting:: CSRF_COOKIE_SECURE
    
  404. 
    
  405. ``CSRF_COOKIE_SECURE``
    
  406. ----------------------
    
  407. 
    
  408. Default: ``False``
    
  409. 
    
  410. Whether to use a secure cookie for the CSRF cookie. If this is set to ``True``,
    
  411. the cookie will be marked as "secure", which means browsers may ensure that the
    
  412. cookie is only sent with an HTTPS connection.
    
  413. 
    
  414. .. setting:: CSRF_USE_SESSIONS
    
  415. 
    
  416. ``CSRF_USE_SESSIONS``
    
  417. ---------------------
    
  418. 
    
  419. Default: ``False``
    
  420. 
    
  421. Whether to store the CSRF token in the user's session instead of in a cookie.
    
  422. It requires the use of :mod:`django.contrib.sessions`.
    
  423. 
    
  424. Storing the CSRF token in a cookie (Django's default) is safe, but storing it
    
  425. in the session is common practice in other web frameworks and therefore
    
  426. sometimes demanded by security auditors.
    
  427. 
    
  428. Since the :ref:`default error views <error-views>` require the CSRF token,
    
  429. :class:`~django.contrib.sessions.middleware.SessionMiddleware` must appear in
    
  430. :setting:`MIDDLEWARE` before any middleware that may raise an exception to
    
  431. trigger an error view (such as :exc:`~django.core.exceptions.PermissionDenied`)
    
  432. if you're using ``CSRF_USE_SESSIONS``. See :ref:`middleware-ordering`.
    
  433. 
    
  434. .. setting:: CSRF_FAILURE_VIEW
    
  435. 
    
  436. ``CSRF_FAILURE_VIEW``
    
  437. ---------------------
    
  438. 
    
  439. Default: ``'django.views.csrf.csrf_failure'``
    
  440. 
    
  441. A dotted path to the view function to be used when an incoming request is
    
  442. rejected by the :doc:`CSRF protection </ref/csrf>`. The function should have
    
  443. this signature::
    
  444. 
    
  445.     def csrf_failure(request, reason=""):
    
  446.         ...
    
  447. 
    
  448. where ``reason`` is a short message (intended for developers or logging, not
    
  449. for end users) indicating the reason the request was rejected. It should return
    
  450. an :class:`~django.http.HttpResponseForbidden`.
    
  451. 
    
  452. ``django.views.csrf.csrf_failure()`` accepts an additional ``template_name``
    
  453. parameter that defaults to ``'403_csrf.html'``. If a template with that name
    
  454. exists, it will be used to render the page.
    
  455. 
    
  456. .. setting:: CSRF_HEADER_NAME
    
  457. 
    
  458. ``CSRF_HEADER_NAME``
    
  459. --------------------
    
  460. 
    
  461. Default: ``'HTTP_X_CSRFTOKEN'``
    
  462. 
    
  463. The name of the request header used for CSRF authentication.
    
  464. 
    
  465. As with other HTTP headers in ``request.META``, the header name received from
    
  466. the server is normalized by converting all characters to uppercase, replacing
    
  467. any hyphens with underscores, and adding an ``'HTTP_'`` prefix to the name.
    
  468. For example, if your client sends a ``'X-XSRF-TOKEN'`` header, the setting
    
  469. should be ``'HTTP_X_XSRF_TOKEN'``.
    
  470. 
    
  471. .. setting:: CSRF_TRUSTED_ORIGINS
    
  472. 
    
  473. ``CSRF_TRUSTED_ORIGINS``
    
  474. ------------------------
    
  475. 
    
  476. Default: ``[]`` (Empty list)
    
  477. 
    
  478. A list of trusted origins for unsafe requests (e.g. ``POST``).
    
  479. 
    
  480. For requests that include the ``Origin`` header, Django's CSRF protection
    
  481. requires that header match the origin present in the ``Host`` header.
    
  482. 
    
  483. For a :meth:`secure <django.http.HttpRequest.is_secure>` unsafe
    
  484. request that doesn't include the ``Origin`` header, the request must have a
    
  485. ``Referer`` header that matches the origin present in the ``Host`` header.
    
  486. 
    
  487. These checks prevent, for example, a ``POST`` request from
    
  488. ``subdomain.example.com`` from succeeding against ``api.example.com``. If you
    
  489. need cross-origin unsafe requests, continuing the example, add
    
  490. ``'https://subdomain.example.com'`` to this list (and/or ``http://...`` if
    
  491. requests originate from an insecure page).
    
  492. 
    
  493. The setting also supports subdomains, so you could add
    
  494. ``'https://*.example.com'``, for example, to allow access from all subdomains
    
  495. of ``example.com``.
    
  496. 
    
  497. .. versionchanged:: 4.0
    
  498. 
    
  499.     The values in older versions must only include the hostname (possibly with
    
  500.     a leading dot) and not the scheme or an asterisk.
    
  501. 
    
  502.     Also, ``Origin`` header checking isn't performed in older versions.
    
  503. 
    
  504. .. setting:: DATABASES
    
  505. 
    
  506. ``DATABASES``
    
  507. -------------
    
  508. 
    
  509. Default: ``{}`` (Empty dictionary)
    
  510. 
    
  511. A dictionary containing the settings for all databases to be used with
    
  512. Django. It is a nested dictionary whose contents map a database alias
    
  513. to a dictionary containing the options for an individual database.
    
  514. 
    
  515. The :setting:`DATABASES` setting must configure a ``default`` database;
    
  516. any number of additional databases may also be specified.
    
  517. 
    
  518. The simplest possible settings file is for a single-database setup using
    
  519. SQLite. This can be configured using the following::
    
  520. 
    
  521.     DATABASES = {
    
  522.         'default': {
    
  523.             'ENGINE': 'django.db.backends.sqlite3',
    
  524.             'NAME': 'mydatabase',
    
  525.         }
    
  526.     }
    
  527. 
    
  528. When connecting to other database backends, such as MariaDB, MySQL, Oracle, or
    
  529. PostgreSQL, additional connection parameters will be required. See
    
  530. the :setting:`ENGINE <DATABASE-ENGINE>` setting below on how to specify
    
  531. other database types. This example is for PostgreSQL::
    
  532. 
    
  533.     DATABASES = {
    
  534.         'default': {
    
  535.             'ENGINE': 'django.db.backends.postgresql',
    
  536.             'NAME': 'mydatabase',
    
  537.             'USER': 'mydatabaseuser',
    
  538.             'PASSWORD': 'mypassword',
    
  539.             'HOST': '127.0.0.1',
    
  540.             'PORT': '5432',
    
  541.         }
    
  542.     }
    
  543. 
    
  544. The following inner options that may be required for more complex
    
  545. configurations are available:
    
  546. 
    
  547. .. setting:: DATABASE-ATOMIC_REQUESTS
    
  548. 
    
  549. ``ATOMIC_REQUESTS``
    
  550. ~~~~~~~~~~~~~~~~~~~
    
  551. 
    
  552. Default: ``False``
    
  553. 
    
  554. Set this to ``True`` to wrap each view in a transaction on this database. See
    
  555. :ref:`tying-transactions-to-http-requests`.
    
  556. 
    
  557. .. setting:: DATABASE-AUTOCOMMIT
    
  558. 
    
  559. ``AUTOCOMMIT``
    
  560. ~~~~~~~~~~~~~~
    
  561. 
    
  562. Default: ``True``
    
  563. 
    
  564. Set this to ``False`` if you want to :ref:`disable Django's transaction
    
  565. management <deactivate-transaction-management>` and implement your own.
    
  566. 
    
  567. .. setting:: DATABASE-ENGINE
    
  568. 
    
  569. ``ENGINE``
    
  570. ~~~~~~~~~~
    
  571. 
    
  572. Default: ``''`` (Empty string)
    
  573. 
    
  574. The database backend to use. The built-in database backends are:
    
  575. 
    
  576. * ``'django.db.backends.postgresql'``
    
  577. * ``'django.db.backends.mysql'``
    
  578. * ``'django.db.backends.sqlite3'``
    
  579. * ``'django.db.backends.oracle'``
    
  580. 
    
  581. You can use a database backend that doesn't ship with Django by setting
    
  582. ``ENGINE`` to a fully-qualified path (i.e. ``mypackage.backends.whatever``).
    
  583. 
    
  584. .. setting:: HOST
    
  585. 
    
  586. ``HOST``
    
  587. ~~~~~~~~
    
  588. 
    
  589. Default: ``''`` (Empty string)
    
  590. 
    
  591. Which host to use when connecting to the database. An empty string means
    
  592. localhost. Not used with SQLite.
    
  593. 
    
  594. If this value starts with a forward slash (``'/'``) and you're using MySQL,
    
  595. MySQL will connect via a Unix socket to the specified socket. For example::
    
  596. 
    
  597.     "HOST": '/var/run/mysql'
    
  598. 
    
  599. If you're using MySQL and this value *doesn't* start with a forward slash, then
    
  600. this value is assumed to be the host.
    
  601. 
    
  602. If you're using PostgreSQL, by default (empty :setting:`HOST`), the connection
    
  603. to the database is done through UNIX domain sockets ('local' lines in
    
  604. ``pg_hba.conf``). If your UNIX domain socket is not in the standard location,
    
  605. use the same value of ``unix_socket_directory`` from ``postgresql.conf``.
    
  606. If you want to connect through TCP sockets, set :setting:`HOST` to 'localhost'
    
  607. or '127.0.0.1' ('host' lines in ``pg_hba.conf``).
    
  608. On Windows, you should always define :setting:`HOST`, as UNIX domain sockets
    
  609. are not available.
    
  610. 
    
  611. .. setting:: NAME
    
  612. 
    
  613. ``NAME``
    
  614. ~~~~~~~~
    
  615. 
    
  616. Default: ``''`` (Empty string)
    
  617. 
    
  618. The name of the database to use. For SQLite, it's the full path to the database
    
  619. file. When specifying the path, always use forward slashes, even on Windows
    
  620. (e.g. ``C:/homes/user/mysite/sqlite3.db``).
    
  621. 
    
  622. .. setting:: CONN_MAX_AGE
    
  623. 
    
  624. ``CONN_MAX_AGE``
    
  625. ~~~~~~~~~~~~~~~~
    
  626. 
    
  627. Default: ``0``
    
  628. 
    
  629. The lifetime of a database connection, as an integer of seconds. Use ``0`` to
    
  630. close database connections at the end of each request — Django's historical
    
  631. behavior — and ``None`` for unlimited :ref:`persistent database connections
    
  632. <persistent-database-connections>`.
    
  633. 
    
  634. .. setting:: CONN_HEALTH_CHECKS
    
  635. 
    
  636. ``CONN_HEALTH_CHECKS``
    
  637. ~~~~~~~~~~~~~~~~~~~~~~
    
  638. 
    
  639. .. versionadded:: 4.1
    
  640. 
    
  641. Default: ``False``
    
  642. 
    
  643. If set to ``True``, existing :ref:`persistent database connections
    
  644. <persistent-database-connections>` will be health checked before they are
    
  645. reused in each request performing database access. If the health check fails,
    
  646. the connection will be reestablished without failing the request when the
    
  647. connection is no longer usable but the database server is ready to accept and
    
  648. serve new connections (e.g. after database server restart closing existing
    
  649. connections).
    
  650. 
    
  651. .. setting:: OPTIONS
    
  652. 
    
  653. ``OPTIONS``
    
  654. ~~~~~~~~~~~
    
  655. 
    
  656. Default: ``{}`` (Empty dictionary)
    
  657. 
    
  658. Extra parameters to use when connecting to the database. Available parameters
    
  659. vary depending on your database backend.
    
  660. 
    
  661. Some information on available parameters can be found in the
    
  662. :doc:`Database Backends </ref/databases>` documentation. For more information,
    
  663. consult your backend module's own documentation.
    
  664. 
    
  665. .. setting:: PASSWORD
    
  666. 
    
  667. ``PASSWORD``
    
  668. ~~~~~~~~~~~~
    
  669. 
    
  670. Default: ``''`` (Empty string)
    
  671. 
    
  672. The password to use when connecting to the database. Not used with SQLite.
    
  673. 
    
  674. .. setting:: PORT
    
  675. 
    
  676. ``PORT``
    
  677. ~~~~~~~~
    
  678. 
    
  679. Default: ``''`` (Empty string)
    
  680. 
    
  681. The port to use when connecting to the database. An empty string means the
    
  682. default port. Not used with SQLite.
    
  683. 
    
  684. .. setting:: DATABASE-TIME_ZONE
    
  685. 
    
  686. ``TIME_ZONE``
    
  687. ~~~~~~~~~~~~~
    
  688. 
    
  689. Default: ``None``
    
  690. 
    
  691. A string representing the time zone for this database connection or ``None``.
    
  692. This inner option of the :setting:`DATABASES` setting accepts the same values
    
  693. as the general :setting:`TIME_ZONE` setting.
    
  694. 
    
  695. When :setting:`USE_TZ` is ``True`` and this option is set, reading datetimes
    
  696. from the database returns aware datetimes in this time zone instead of UTC.
    
  697. When :setting:`USE_TZ` is ``False``, it is an error to set this option.
    
  698. 
    
  699. * If the database backend doesn't support time zones (e.g. SQLite, MySQL,
    
  700.   Oracle), Django reads and writes datetimes in local time according to this
    
  701.   option if it is set and in UTC if it isn't.
    
  702. 
    
  703.   Changing the connection time zone changes how datetimes are read from and
    
  704.   written to the database.
    
  705. 
    
  706.   * If Django manages the database and you don't have a strong reason to do
    
  707.     otherwise, you should leave this option unset. It's best to store datetimes
    
  708.     in UTC because it avoids ambiguous or nonexistent datetimes during daylight
    
  709.     saving time changes. Also, receiving datetimes in UTC keeps datetime
    
  710.     arithmetic simple — there's no need to consider potential offset changes
    
  711.     over a DST transition.
    
  712. 
    
  713.   * If you're connecting to a third-party database that stores datetimes in a
    
  714.     local time rather than UTC, then you must set this option to the
    
  715.     appropriate time zone. Likewise, if Django manages the database but
    
  716.     third-party systems connect to the same database and expect to find
    
  717.     datetimes in local time, then you must set this option.
    
  718. 
    
  719. * If the database backend supports time zones (e.g. PostgreSQL), the
    
  720.   ``TIME_ZONE`` option is very rarely needed. It can be changed at any time;
    
  721.   the database takes care of converting datetimes to the desired time zone.
    
  722. 
    
  723.   Setting the time zone of the database connection may be useful for running
    
  724.   raw SQL queries involving date/time functions provided by the database, such
    
  725.   as ``date_trunc``, because their results depend on the time zone.
    
  726. 
    
  727.   However, this has a downside: receiving all datetimes in local time makes
    
  728.   datetime arithmetic more tricky — you must account for possible offset
    
  729.   changes over DST transitions.
    
  730. 
    
  731.   Consider converting to local time explicitly with ``AT TIME ZONE`` in raw SQL
    
  732.   queries instead of setting the ``TIME_ZONE`` option.
    
  733. 
    
  734. .. setting:: DATABASE-DISABLE_SERVER_SIDE_CURSORS
    
  735. 
    
  736. ``DISABLE_SERVER_SIDE_CURSORS``
    
  737. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    
  738. 
    
  739. Default: ``False``
    
  740. 
    
  741. Set this to ``True`` if you want to disable the use of server-side cursors with
    
  742. :meth:`.QuerySet.iterator`. :ref:`transaction-pooling-server-side-cursors`
    
  743. describes the use case.
    
  744. 
    
  745. This is a PostgreSQL-specific setting.
    
  746. 
    
  747. .. setting:: USER
    
  748. 
    
  749. ``USER``
    
  750. ~~~~~~~~
    
  751. 
    
  752. Default: ``''`` (Empty string)
    
  753. 
    
  754. The username to use when connecting to the database. Not used with SQLite.
    
  755. 
    
  756. .. setting:: DATABASE-TEST
    
  757. 
    
  758. ``TEST``
    
  759. ~~~~~~~~
    
  760. 
    
  761. Default: ``{}`` (Empty dictionary)
    
  762. 
    
  763. A dictionary of settings for test databases; for more details about the
    
  764. creation and use of test databases, see :ref:`the-test-database`.
    
  765. 
    
  766. Here's an example with a test database configuration::
    
  767. 
    
  768.     DATABASES = {
    
  769.         'default': {
    
  770.             'ENGINE': 'django.db.backends.postgresql',
    
  771.             'USER': 'mydatabaseuser',
    
  772.             'NAME': 'mydatabase',
    
  773.             'TEST': {
    
  774.                 'NAME': 'mytestdatabase',
    
  775.             },
    
  776.         },
    
  777.     }
    
  778. 
    
  779. The following keys in the ``TEST`` dictionary are available:
    
  780. 
    
  781. .. setting:: TEST_CHARSET
    
  782. 
    
  783. ``CHARSET``
    
  784. ^^^^^^^^^^^
    
  785. 
    
  786. Default: ``None``
    
  787. 
    
  788. The character set encoding used to create the test database. The value of this
    
  789. string is passed directly through to the database, so its format is
    
  790. backend-specific.
    
  791. 
    
  792. Supported by the PostgreSQL_ (``postgresql``) and MySQL_ (``mysql``) backends.
    
  793. 
    
  794. .. _PostgreSQL: https://www.postgresql.org/docs/current/multibyte.html
    
  795. .. _MySQL: https://dev.mysql.com/doc/refman/en/charset-charsets.html
    
  796. 
    
  797. .. setting:: TEST_COLLATION
    
  798. 
    
  799. ``COLLATION``
    
  800. ^^^^^^^^^^^^^
    
  801. 
    
  802. Default: ``None``
    
  803. 
    
  804. The collation order to use when creating the test database. This value is
    
  805. passed directly to the backend, so its format is backend-specific.
    
  806. 
    
  807. Only supported for the ``mysql`` backend (see the `MySQL manual`_ for details).
    
  808. 
    
  809. .. _MySQL manual: MySQL_
    
  810. 
    
  811. .. setting:: TEST_DEPENDENCIES
    
  812. 
    
  813. ``DEPENDENCIES``
    
  814. ^^^^^^^^^^^^^^^^
    
  815. 
    
  816. Default: ``['default']``, for all databases other than ``default``,
    
  817. which has no dependencies.
    
  818. 
    
  819. The creation-order dependencies of the database. See the documentation
    
  820. on :ref:`controlling the creation order of test databases
    
  821. <topics-testing-creation-dependencies>` for details.
    
  822. 
    
  823. .. setting:: TEST_MIGRATE
    
  824. 
    
  825. ``MIGRATE``
    
  826. ^^^^^^^^^^^
    
  827. 
    
  828. Default: ``True``
    
  829. 
    
  830. When set to ``False``, migrations won't run when creating the test database.
    
  831. This is similar to setting ``None`` as a value in :setting:`MIGRATION_MODULES`,
    
  832. but for all apps.
    
  833. 
    
  834. .. setting:: TEST_MIRROR
    
  835. 
    
  836. ``MIRROR``
    
  837. ^^^^^^^^^^
    
  838. 
    
  839. Default: ``None``
    
  840. 
    
  841. The alias of the database that this database should mirror during
    
  842. testing. It depends on transactions and therefore must be used within
    
  843. :class:`~django.test.TransactionTestCase` instead of
    
  844. :class:`~django.test.TestCase`.
    
  845. 
    
  846. This setting exists to allow for testing of primary/replica
    
  847. (referred to as master/slave by some databases)
    
  848. configurations of multiple databases. See the documentation on
    
  849. :ref:`testing primary/replica configurations
    
  850. <topics-testing-primaryreplica>` for details.
    
  851. 
    
  852. .. setting:: TEST_NAME
    
  853. 
    
  854. ``NAME``
    
  855. ^^^^^^^^
    
  856. 
    
  857. Default: ``None``
    
  858. 
    
  859. The name of database to use when running the test suite.
    
  860. 
    
  861. If the default value (``None``) is used with the SQLite database engine, the
    
  862. tests will use a memory resident database. For all other database engines the
    
  863. test database will use the name ``'test_' + DATABASE_NAME``.
    
  864. 
    
  865. See :ref:`the-test-database`.
    
  866. 
    
  867. .. setting:: TEST_SERIALIZE
    
  868. 
    
  869. ``SERIALIZE``
    
  870. ^^^^^^^^^^^^^
    
  871. 
    
  872. Boolean value to control whether or not the default test runner serializes the
    
  873. database into an in-memory JSON string before running tests (used to restore
    
  874. the database state between tests if you don't have transactions). You can set
    
  875. this to ``False`` to speed up creation time if you don't have any test classes
    
  876. with :ref:`serialized_rollback=True <test-case-serialized-rollback>`.
    
  877. 
    
  878. .. deprecated:: 4.0
    
  879. 
    
  880.    This setting is deprecated as it can be inferred from the
    
  881.    :attr:`~django.test.TestCase.databases` with the
    
  882.    :ref:`serialized_rollback <test-case-serialized-rollback>` option enabled.
    
  883. 
    
  884. .. setting:: TEST_TEMPLATE
    
  885. 
    
  886. ``TEMPLATE``
    
  887. ^^^^^^^^^^^^
    
  888. 
    
  889. This is a PostgreSQL-specific setting.
    
  890. 
    
  891. The name of a `template`_ (e.g. ``'template0'``) from which to create the test
    
  892. database.
    
  893. 
    
  894. .. _template: https://www.postgresql.org/docs/current/sql-createdatabase.html
    
  895. 
    
  896. .. setting:: TEST_CREATE
    
  897. 
    
  898. ``CREATE_DB``
    
  899. ^^^^^^^^^^^^^
    
  900. 
    
  901. Default: ``True``
    
  902. 
    
  903. This is an Oracle-specific setting.
    
  904. 
    
  905. If it is set to ``False``, the test tablespaces won't be automatically created
    
  906. at the beginning of the tests or dropped at the end.
    
  907. 
    
  908. .. setting:: TEST_USER_CREATE
    
  909. 
    
  910. ``CREATE_USER``
    
  911. ^^^^^^^^^^^^^^^
    
  912. 
    
  913. Default: ``True``
    
  914. 
    
  915. This is an Oracle-specific setting.
    
  916. 
    
  917. If it is set to ``False``, the test user won't be automatically created at the
    
  918. beginning of the tests and dropped at the end.
    
  919. 
    
  920. .. setting:: TEST_USER
    
  921. 
    
  922. ``USER``
    
  923. ^^^^^^^^
    
  924. 
    
  925. Default: ``None``
    
  926. 
    
  927. This is an Oracle-specific setting.
    
  928. 
    
  929. The username to use when connecting to the Oracle database that will be used
    
  930. when running tests. If not provided, Django will use ``'test_' + USER``.
    
  931. 
    
  932. .. setting:: TEST_PASSWD
    
  933. 
    
  934. ``PASSWORD``
    
  935. ^^^^^^^^^^^^
    
  936. 
    
  937. Default: ``None``
    
  938. 
    
  939. This is an Oracle-specific setting.
    
  940. 
    
  941. The password to use when connecting to the Oracle database that will be used
    
  942. when running tests. If not provided, Django will generate a random password.
    
  943. 
    
  944. .. setting:: TEST_ORACLE_MANAGED_FILES
    
  945. 
    
  946. ``ORACLE_MANAGED_FILES``
    
  947. ^^^^^^^^^^^^^^^^^^^^^^^^
    
  948. 
    
  949. Default: ``False``
    
  950. 
    
  951. This is an Oracle-specific setting.
    
  952. 
    
  953. If set to ``True``, Oracle Managed Files (OMF) tablespaces will be used.
    
  954. :setting:`DATAFILE` and :setting:`DATAFILE_TMP` will be ignored.
    
  955. 
    
  956. .. setting:: TEST_TBLSPACE
    
  957. 
    
  958. ``TBLSPACE``
    
  959. ^^^^^^^^^^^^
    
  960. 
    
  961. Default: ``None``
    
  962. 
    
  963. This is an Oracle-specific setting.
    
  964. 
    
  965. The name of the tablespace that will be used when running tests. If not
    
  966. provided, Django will use ``'test_' + USER``.
    
  967. 
    
  968. .. setting:: TEST_TBLSPACE_TMP
    
  969. 
    
  970. ``TBLSPACE_TMP``
    
  971. ^^^^^^^^^^^^^^^^
    
  972. 
    
  973. Default: ``None``
    
  974. 
    
  975. This is an Oracle-specific setting.
    
  976. 
    
  977. The name of the temporary tablespace that will be used when running tests. If
    
  978. not provided, Django will use ``'test_' + USER + '_temp'``.
    
  979. 
    
  980. .. setting:: DATAFILE
    
  981. 
    
  982. ``DATAFILE``
    
  983. ^^^^^^^^^^^^
    
  984. 
    
  985. Default: ``None``
    
  986. 
    
  987. This is an Oracle-specific setting.
    
  988. 
    
  989. The name of the datafile to use for the TBLSPACE. If not provided, Django will
    
  990. use ``TBLSPACE + '.dbf'``.
    
  991. 
    
  992. .. setting:: DATAFILE_TMP
    
  993. 
    
  994. ``DATAFILE_TMP``
    
  995. ^^^^^^^^^^^^^^^^
    
  996. 
    
  997. Default: ``None``
    
  998. 
    
  999. This is an Oracle-specific setting.
    
  1000. 
    
  1001. The name of the datafile to use for the TBLSPACE_TMP. If not provided, Django
    
  1002. will use ``TBLSPACE_TMP + '.dbf'``.
    
  1003. 
    
  1004. .. setting:: DATAFILE_MAXSIZE
    
  1005. 
    
  1006. ``DATAFILE_MAXSIZE``
    
  1007. ^^^^^^^^^^^^^^^^^^^^
    
  1008. 
    
  1009. Default: ``'500M'``
    
  1010. 
    
  1011. This is an Oracle-specific setting.
    
  1012. 
    
  1013. The maximum size that the DATAFILE is allowed to grow to.
    
  1014. 
    
  1015. .. setting:: DATAFILE_TMP_MAXSIZE
    
  1016. 
    
  1017. ``DATAFILE_TMP_MAXSIZE``
    
  1018. ^^^^^^^^^^^^^^^^^^^^^^^^
    
  1019. 
    
  1020. Default: ``'500M'``
    
  1021. 
    
  1022. This is an Oracle-specific setting.
    
  1023. 
    
  1024. The maximum size that the DATAFILE_TMP is allowed to grow to.
    
  1025. 
    
  1026. .. setting:: DATAFILE_SIZE
    
  1027. 
    
  1028. ``DATAFILE_SIZE``
    
  1029. ^^^^^^^^^^^^^^^^^
    
  1030. 
    
  1031. Default: ``'50M'``
    
  1032. 
    
  1033. This is an Oracle-specific setting.
    
  1034. 
    
  1035. The initial size of the DATAFILE.
    
  1036. 
    
  1037. .. setting:: DATAFILE_TMP_SIZE
    
  1038. 
    
  1039. ``DATAFILE_TMP_SIZE``
    
  1040. ^^^^^^^^^^^^^^^^^^^^^
    
  1041. 
    
  1042. Default: ``'50M'``
    
  1043. 
    
  1044. This is an Oracle-specific setting.
    
  1045. 
    
  1046. The initial size of the DATAFILE_TMP.
    
  1047. 
    
  1048. .. setting:: DATAFILE_EXTSIZE
    
  1049. 
    
  1050. ``DATAFILE_EXTSIZE``
    
  1051. ^^^^^^^^^^^^^^^^^^^^
    
  1052. 
    
  1053. Default: ``'25M'``
    
  1054. 
    
  1055. This is an Oracle-specific setting.
    
  1056. 
    
  1057. The amount by which the DATAFILE is extended when more space is required.
    
  1058. 
    
  1059. .. setting:: DATAFILE_TMP_EXTSIZE
    
  1060. 
    
  1061. ``DATAFILE_TMP_EXTSIZE``
    
  1062. ^^^^^^^^^^^^^^^^^^^^^^^^
    
  1063. 
    
  1064. Default: ``'25M'``
    
  1065. 
    
  1066. This is an Oracle-specific setting.
    
  1067. 
    
  1068. The amount by which the DATAFILE_TMP is extended when more space is required.
    
  1069. 
    
  1070. .. setting:: DATA_UPLOAD_MAX_MEMORY_SIZE
    
  1071. 
    
  1072. ``DATA_UPLOAD_MAX_MEMORY_SIZE``
    
  1073. -------------------------------
    
  1074. 
    
  1075. Default: ``2621440`` (i.e. 2.5 MB).
    
  1076. 
    
  1077. The maximum size in bytes that a request body may be before a
    
  1078. :exc:`~django.core.exceptions.SuspiciousOperation` (``RequestDataTooBig``) is
    
  1079. raised. The check is done when accessing ``request.body`` or ``request.POST``
    
  1080. and is calculated against the total request size excluding any file upload
    
  1081. data. You can set this to ``None`` to disable the check. Applications that are
    
  1082. expected to receive unusually large form posts should tune this setting.
    
  1083. 
    
  1084. The amount of request data is correlated to the amount of memory needed to
    
  1085. process the request and populate the GET and POST dictionaries. Large requests
    
  1086. could be used as a denial-of-service attack vector if left unchecked. Since web
    
  1087. servers don't typically perform deep request inspection, it's not possible to
    
  1088. perform a similar check at that level.
    
  1089. 
    
  1090. See also :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`.
    
  1091. 
    
  1092. .. setting:: DATA_UPLOAD_MAX_NUMBER_FIELDS
    
  1093. 
    
  1094. ``DATA_UPLOAD_MAX_NUMBER_FIELDS``
    
  1095. ---------------------------------
    
  1096. 
    
  1097. Default: ``1000``
    
  1098. 
    
  1099. The maximum number of parameters that may be received via GET or POST before a
    
  1100. :exc:`~django.core.exceptions.SuspiciousOperation` (``TooManyFields``) is
    
  1101. raised. You can set this to ``None`` to disable the check. Applications that
    
  1102. are expected to receive an unusually large number of form fields should tune
    
  1103. this setting.
    
  1104. 
    
  1105. The number of request parameters is correlated to the amount of time needed to
    
  1106. process the request and populate the GET and POST dictionaries. Large requests
    
  1107. could be used as a denial-of-service attack vector if left unchecked. Since web
    
  1108. servers don't typically perform deep request inspection, it's not possible to
    
  1109. perform a similar check at that level.
    
  1110. 
    
  1111. .. setting:: DATA_UPLOAD_MAX_NUMBER_FILES
    
  1112. 
    
  1113. ``DATA_UPLOAD_MAX_NUMBER_FILES``
    
  1114. --------------------------------
    
  1115. 
    
  1116. .. versionadded:: 3.2.18
    
  1117. 
    
  1118. Default: ``100``
    
  1119. 
    
  1120. The maximum number of files that may be received via POST in a
    
  1121. ``multipart/form-data`` encoded request before a
    
  1122. :exc:`~django.core.exceptions.SuspiciousOperation` (``TooManyFiles``) is
    
  1123. raised. You can set this to ``None`` to disable the check. Applications that
    
  1124. are expected to receive an unusually large number of file fields should tune
    
  1125. this setting.
    
  1126. 
    
  1127. The number of accepted files is correlated to the amount of time and memory
    
  1128. needed to process the request. Large requests could be used as a
    
  1129. denial-of-service attack vector if left unchecked. Since web servers don't
    
  1130. typically perform deep request inspection, it's not possible to perform a
    
  1131. similar check at that level.
    
  1132. 
    
  1133. .. setting:: DATABASE_ROUTERS
    
  1134. 
    
  1135. ``DATABASE_ROUTERS``
    
  1136. --------------------
    
  1137. 
    
  1138. Default: ``[]`` (Empty list)
    
  1139. 
    
  1140. The list of routers that will be used to determine which database
    
  1141. to use when performing a database query.
    
  1142. 
    
  1143. See the documentation on :ref:`automatic database routing in multi
    
  1144. database configurations <topics-db-multi-db-routing>`.
    
  1145. 
    
  1146. .. setting:: DATE_FORMAT
    
  1147. 
    
  1148. ``DATE_FORMAT``
    
  1149. ---------------
    
  1150. 
    
  1151. Default: ``'N j, Y'`` (e.g. ``Feb. 4, 2003``)
    
  1152. 
    
  1153. The default formatting to use for displaying date fields in any part of the
    
  1154. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
    
  1155. locale-dictated format has higher precedence and will be applied instead. See
    
  1156. :tfilter:`allowed date format strings <date>`.
    
  1157. 
    
  1158. See also :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
    
  1159. 
    
  1160. .. setting:: DATE_INPUT_FORMATS
    
  1161. 
    
  1162. ``DATE_INPUT_FORMATS``
    
  1163. ----------------------
    
  1164. 
    
  1165. Default::
    
  1166. 
    
  1167.     [
    
  1168.         '%Y-%m-%d',  # '2006-10-25'
    
  1169.         '%m/%d/%Y',  # '10/25/2006'
    
  1170.         '%m/%d/%y',  # '10/25/06'
    
  1171.         '%b %d %Y',  # 'Oct 25 2006'
    
  1172.         '%b %d, %Y',  # 'Oct 25, 2006'
    
  1173.         '%d %b %Y',  # '25 Oct 2006'
    
  1174.         '%d %b, %Y',  # '25 Oct, 2006'
    
  1175.         '%B %d %Y',  # 'October 25 2006'
    
  1176.         '%B %d, %Y',  # 'October 25, 2006'
    
  1177.         '%d %B %Y',  # '25 October 2006'
    
  1178.         '%d %B, %Y',  # '25 October, 2006'
    
  1179.     ]
    
  1180. 
    
  1181. A list of formats that will be accepted when inputting data on a date field.
    
  1182. Formats will be tried in order, using the first valid one. Note that these
    
  1183. format strings use Python's :ref:`datetime module syntax
    
  1184. <strftime-strptime-behavior>`, not the format strings from the :tfilter:`date`
    
  1185. template filter.
    
  1186. 
    
  1187. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
    
  1188. precedence and will be applied instead.
    
  1189. 
    
  1190. See also :setting:`DATETIME_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
    
  1191. 
    
  1192. .. setting:: DATETIME_FORMAT
    
  1193. 
    
  1194. ``DATETIME_FORMAT``
    
  1195. -------------------
    
  1196. 
    
  1197. Default: ``'N j, Y, P'`` (e.g. ``Feb. 4, 2003, 4 p.m.``)
    
  1198. 
    
  1199. The default formatting to use for displaying datetime fields in any part of the
    
  1200. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
    
  1201. locale-dictated format has higher precedence and will be applied instead. See
    
  1202. :tfilter:`allowed date format strings <date>`.
    
  1203. 
    
  1204. See also :setting:`DATE_FORMAT`, :setting:`TIME_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
    
  1205. 
    
  1206. .. setting:: DATETIME_INPUT_FORMATS
    
  1207. 
    
  1208. ``DATETIME_INPUT_FORMATS``
    
  1209. --------------------------
    
  1210. 
    
  1211. Default::
    
  1212. 
    
  1213.     [
    
  1214.         '%Y-%m-%d %H:%M:%S',     # '2006-10-25 14:30:59'
    
  1215.         '%Y-%m-%d %H:%M:%S.%f',  # '2006-10-25 14:30:59.000200'
    
  1216.         '%Y-%m-%d %H:%M',        # '2006-10-25 14:30'
    
  1217.         '%m/%d/%Y %H:%M:%S',     # '10/25/2006 14:30:59'
    
  1218.         '%m/%d/%Y %H:%M:%S.%f',  # '10/25/2006 14:30:59.000200'
    
  1219.         '%m/%d/%Y %H:%M',        # '10/25/2006 14:30'
    
  1220.         '%m/%d/%y %H:%M:%S',     # '10/25/06 14:30:59'
    
  1221.         '%m/%d/%y %H:%M:%S.%f',  # '10/25/06 14:30:59.000200'
    
  1222.         '%m/%d/%y %H:%M',        # '10/25/06 14:30'
    
  1223.     ]
    
  1224. 
    
  1225. A list of formats that will be accepted when inputting data on a datetime
    
  1226. field. Formats will be tried in order, using the first valid one. Note that
    
  1227. these format strings use Python's :ref:`datetime module syntax
    
  1228. <strftime-strptime-behavior>`, not the format strings from the :tfilter:`date`
    
  1229. template filter. Date-only formats are not included as datetime fields will
    
  1230. automatically try :setting:`DATE_INPUT_FORMATS` in last resort.
    
  1231. 
    
  1232. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
    
  1233. precedence and will be applied instead.
    
  1234. 
    
  1235. See also :setting:`DATE_INPUT_FORMATS` and :setting:`TIME_INPUT_FORMATS`.
    
  1236. 
    
  1237. .. setting:: DEBUG
    
  1238. 
    
  1239. ``DEBUG``
    
  1240. ---------
    
  1241. 
    
  1242. Default: ``False``
    
  1243. 
    
  1244. A boolean that turns on/off debug mode.
    
  1245. 
    
  1246. Never deploy a site into production with :setting:`DEBUG` turned on.
    
  1247. 
    
  1248. One of the main features of debug mode is the display of detailed error pages.
    
  1249. If your app raises an exception when :setting:`DEBUG` is ``True``, Django will
    
  1250. display a detailed traceback, including a lot of metadata about your
    
  1251. environment, such as all the currently defined Django settings (from
    
  1252. ``settings.py``).
    
  1253. 
    
  1254. As a security measure, Django will *not* include settings that might be
    
  1255. sensitive, such as :setting:`SECRET_KEY`. Specifically, it will exclude any
    
  1256. setting whose name includes any of the following:
    
  1257. 
    
  1258. * ``'API'``
    
  1259. * ``'KEY'``
    
  1260. * ``'PASS'``
    
  1261. * ``'SECRET'``
    
  1262. * ``'SIGNATURE'``
    
  1263. * ``'TOKEN'``
    
  1264. 
    
  1265. Note that these are *partial* matches. ``'PASS'`` will also match PASSWORD,
    
  1266. just as ``'TOKEN'`` will also match TOKENIZED and so on.
    
  1267. 
    
  1268. Still, note that there are always going to be sections of your debug output
    
  1269. that are inappropriate for public consumption. File paths, configuration
    
  1270. options and the like all give attackers extra information about your server.
    
  1271. 
    
  1272. It is also important to remember that when running with :setting:`DEBUG`
    
  1273. turned on, Django will remember every SQL query it executes. This is useful
    
  1274. when you're debugging, but it'll rapidly consume memory on a production server.
    
  1275. 
    
  1276. Finally, if :setting:`DEBUG` is ``False``, you also need to properly set
    
  1277. the :setting:`ALLOWED_HOSTS` setting. Failing to do so will result in all
    
  1278. requests being returned as "Bad Request (400)".
    
  1279. 
    
  1280. .. note::
    
  1281. 
    
  1282.     The default :file:`settings.py` file created by :djadmin:`django-admin
    
  1283.     startproject <startproject>` sets ``DEBUG = True`` for convenience.
    
  1284. 
    
  1285. .. setting:: DEBUG_PROPAGATE_EXCEPTIONS
    
  1286. 
    
  1287. ``DEBUG_PROPAGATE_EXCEPTIONS``
    
  1288. ------------------------------
    
  1289. 
    
  1290. Default: ``False``
    
  1291. 
    
  1292. If set to ``True``, Django's exception handling of view functions
    
  1293. (:data:`~django.conf.urls.handler500`, or the debug view if :setting:`DEBUG`
    
  1294. is ``True``) and logging of 500 responses (:ref:`django-request-logger`) is
    
  1295. skipped and exceptions propagate upward.
    
  1296. 
    
  1297. This can be useful for some test setups. It shouldn't be used on a live site
    
  1298. unless you want your web server (instead of Django) to generate "Internal
    
  1299. Server Error" responses. In that case, make sure your server doesn't show the
    
  1300. stack trace or other sensitive information in the response.
    
  1301. 
    
  1302. .. setting:: DECIMAL_SEPARATOR
    
  1303. 
    
  1304. ``DECIMAL_SEPARATOR``
    
  1305. ---------------------
    
  1306. 
    
  1307. Default: ``'.'`` (Dot)
    
  1308. 
    
  1309. Default decimal separator used when formatting decimal numbers.
    
  1310. 
    
  1311. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
    
  1312. format has higher precedence and will be applied instead.
    
  1313. 
    
  1314. See also :setting:`NUMBER_GROUPING`, :setting:`THOUSAND_SEPARATOR` and
    
  1315. :setting:`USE_THOUSAND_SEPARATOR`.
    
  1316. 
    
  1317. .. setting:: DEFAULT_AUTO_FIELD
    
  1318. 
    
  1319. ``DEFAULT_AUTO_FIELD``
    
  1320. ----------------------
    
  1321. 
    
  1322. Default: ``'``:class:`django.db.models.AutoField`\ ``'``
    
  1323. 
    
  1324. Default primary key field type to use for models that don't have a field with
    
  1325. :attr:`primary_key=True <django.db.models.Field.primary_key>`.
    
  1326. 
    
  1327. .. admonition:: Migrating auto-created through tables
    
  1328. 
    
  1329.     The value of ``DEFAULT_AUTO_FIELD`` will be respected when creating new
    
  1330.     auto-created through tables for many-to-many relationships.
    
  1331. 
    
  1332.     Unfortunately, the primary keys of existing auto-created through tables
    
  1333.     cannot currently be updated by the migrations framework.
    
  1334. 
    
  1335.     This means that if you switch the value of ``DEFAULT_AUTO_FIELD`` and then
    
  1336.     generate migrations, the primary keys of the related models will be
    
  1337.     updated, as will the foreign keys from the through table, but the primary
    
  1338.     key of the auto-created through table will not be migrated.
    
  1339. 
    
  1340.     In order to address this, you should add a
    
  1341.     :class:`~django.db.migrations.operations.RunSQL` operation to your
    
  1342.     migrations to perform the required ``ALTER TABLE`` step. You can check the
    
  1343.     existing table name through ``sqlmigrate``, ``dbshell``, or with the
    
  1344.     field’s ``remote_field.through._meta.db_table`` property.
    
  1345. 
    
  1346.     Explicitly defined through models are already handled by the migrations
    
  1347.     system.
    
  1348. 
    
  1349.     Allowing automatic migrations for the primary key of existing auto-created
    
  1350.     through tables :ticket:`may be implemented at a later date <32674>`.
    
  1351. 
    
  1352. .. setting:: DEFAULT_CHARSET
    
  1353. 
    
  1354. ``DEFAULT_CHARSET``
    
  1355. -------------------
    
  1356. 
    
  1357. Default: ``'utf-8'``
    
  1358. 
    
  1359. Default charset to use for all ``HttpResponse`` objects, if a MIME type isn't
    
  1360. manually specified. Used when constructing the ``Content-Type`` header.
    
  1361. 
    
  1362. .. setting:: DEFAULT_EXCEPTION_REPORTER
    
  1363. 
    
  1364. ``DEFAULT_EXCEPTION_REPORTER``
    
  1365. ------------------------------
    
  1366. 
    
  1367. Default: ``'``:class:`django.views.debug.ExceptionReporter`\ ``'``
    
  1368. 
    
  1369. Default exception reporter class to be used if none has been assigned to the
    
  1370. :class:`~django.http.HttpRequest` instance yet. See
    
  1371. :ref:`custom-error-reports`.
    
  1372. 
    
  1373. .. setting:: DEFAULT_EXCEPTION_REPORTER_FILTER
    
  1374. 
    
  1375. ``DEFAULT_EXCEPTION_REPORTER_FILTER``
    
  1376. -------------------------------------
    
  1377. 
    
  1378. Default: ``'``:class:`django.views.debug.SafeExceptionReporterFilter`\ ``'``
    
  1379. 
    
  1380. Default exception reporter filter class to be used if none has been assigned to
    
  1381. the :class:`~django.http.HttpRequest` instance yet.
    
  1382. See :ref:`Filtering error reports<filtering-error-reports>`.
    
  1383. 
    
  1384. .. setting:: DEFAULT_FILE_STORAGE
    
  1385. 
    
  1386. ``DEFAULT_FILE_STORAGE``
    
  1387. ------------------------
    
  1388. 
    
  1389. Default: ``'``:class:`django.core.files.storage.FileSystemStorage`\ ``'``
    
  1390. 
    
  1391. Default file storage class to be used for any file-related operations that don't
    
  1392. specify a particular storage system. See :doc:`/topics/files`.
    
  1393. 
    
  1394. .. setting:: DEFAULT_FROM_EMAIL
    
  1395. 
    
  1396. ``DEFAULT_FROM_EMAIL``
    
  1397. ----------------------
    
  1398. 
    
  1399. Default: ``'webmaster@localhost'``
    
  1400. 
    
  1401. Default email address to use for various automated correspondence from the
    
  1402. site manager(s). This doesn't include error messages sent to :setting:`ADMINS`
    
  1403. and :setting:`MANAGERS`; for that, see :setting:`SERVER_EMAIL`.
    
  1404. 
    
  1405. .. setting:: DEFAULT_INDEX_TABLESPACE
    
  1406. 
    
  1407. ``DEFAULT_INDEX_TABLESPACE``
    
  1408. ----------------------------
    
  1409. 
    
  1410. Default: ``''`` (Empty string)
    
  1411. 
    
  1412. Default tablespace to use for indexes on fields that don't specify
    
  1413. one, if the backend supports it (see :doc:`/topics/db/tablespaces`).
    
  1414. 
    
  1415. .. setting:: DEFAULT_TABLESPACE
    
  1416. 
    
  1417. ``DEFAULT_TABLESPACE``
    
  1418. ----------------------
    
  1419. 
    
  1420. Default: ``''`` (Empty string)
    
  1421. 
    
  1422. Default tablespace to use for models that don't specify one, if the
    
  1423. backend supports it (see :doc:`/topics/db/tablespaces`).
    
  1424. 
    
  1425. .. setting:: DISALLOWED_USER_AGENTS
    
  1426. 
    
  1427. ``DISALLOWED_USER_AGENTS``
    
  1428. --------------------------
    
  1429. 
    
  1430. Default: ``[]`` (Empty list)
    
  1431. 
    
  1432. List of compiled regular expression objects representing User-Agent strings
    
  1433. that are not allowed to visit any page, systemwide. Use this for bots/crawlers.
    
  1434. This is only used if ``CommonMiddleware`` is installed (see
    
  1435. :doc:`/topics/http/middleware`).
    
  1436. 
    
  1437. .. setting:: EMAIL_BACKEND
    
  1438. 
    
  1439. ``EMAIL_BACKEND``
    
  1440. -----------------
    
  1441. 
    
  1442. Default: ``'``:class:`django.core.mail.backends.smtp.EmailBackend`\ ``'``
    
  1443. 
    
  1444. The backend to use for sending emails. For the list of available backends see
    
  1445. :doc:`/topics/email`.
    
  1446. 
    
  1447. .. setting:: EMAIL_FILE_PATH
    
  1448. 
    
  1449. ``EMAIL_FILE_PATH``
    
  1450. -------------------
    
  1451. 
    
  1452. Default: Not defined
    
  1453. 
    
  1454. The directory used by the :ref:`file email backend <topic-email-file-backend>`
    
  1455. to store output files.
    
  1456. 
    
  1457. .. setting:: EMAIL_HOST
    
  1458. 
    
  1459. ``EMAIL_HOST``
    
  1460. --------------
    
  1461. 
    
  1462. Default: ``'localhost'``
    
  1463. 
    
  1464. The host to use for sending email.
    
  1465. 
    
  1466. See also :setting:`EMAIL_PORT`.
    
  1467. 
    
  1468. .. setting:: EMAIL_HOST_PASSWORD
    
  1469. 
    
  1470. ``EMAIL_HOST_PASSWORD``
    
  1471. -----------------------
    
  1472. 
    
  1473. Default: ``''`` (Empty string)
    
  1474. 
    
  1475. Password to use for the SMTP server defined in :setting:`EMAIL_HOST`. This
    
  1476. setting is used in conjunction with :setting:`EMAIL_HOST_USER` when
    
  1477. authenticating to the SMTP server. If either of these settings is empty,
    
  1478. Django won't attempt authentication.
    
  1479. 
    
  1480. See also :setting:`EMAIL_HOST_USER`.
    
  1481. 
    
  1482. .. setting:: EMAIL_HOST_USER
    
  1483. 
    
  1484. ``EMAIL_HOST_USER``
    
  1485. -------------------
    
  1486. 
    
  1487. Default: ``''`` (Empty string)
    
  1488. 
    
  1489. Username to use for the SMTP server defined in :setting:`EMAIL_HOST`.
    
  1490. If empty, Django won't attempt authentication.
    
  1491. 
    
  1492. See also :setting:`EMAIL_HOST_PASSWORD`.
    
  1493. 
    
  1494. .. setting:: EMAIL_PORT
    
  1495. 
    
  1496. ``EMAIL_PORT``
    
  1497. --------------
    
  1498. 
    
  1499. Default: ``25``
    
  1500. 
    
  1501. Port to use for the SMTP server defined in :setting:`EMAIL_HOST`.
    
  1502. 
    
  1503. .. setting:: EMAIL_SUBJECT_PREFIX
    
  1504. 
    
  1505. ``EMAIL_SUBJECT_PREFIX``
    
  1506. ------------------------
    
  1507. 
    
  1508. Default: ``'[Django] '``
    
  1509. 
    
  1510. Subject-line prefix for email messages sent with ``django.core.mail.mail_admins``
    
  1511. or ``django.core.mail.mail_managers``. You'll probably want to include the
    
  1512. trailing space.
    
  1513. 
    
  1514. .. setting:: EMAIL_USE_LOCALTIME
    
  1515. 
    
  1516. ``EMAIL_USE_LOCALTIME``
    
  1517. -----------------------
    
  1518. 
    
  1519. Default: ``False``
    
  1520. 
    
  1521. Whether to send the SMTP ``Date`` header of email messages in the local time
    
  1522. zone (``True``) or in UTC (``False``).
    
  1523. 
    
  1524. .. setting:: EMAIL_USE_TLS
    
  1525. 
    
  1526. ``EMAIL_USE_TLS``
    
  1527. -----------------
    
  1528. 
    
  1529. Default: ``False``
    
  1530. 
    
  1531. Whether to use a TLS (secure) connection when talking to the SMTP server.
    
  1532. This is used for explicit TLS connections, generally on port 587. If you are
    
  1533. experiencing hanging connections, see the implicit TLS setting
    
  1534. :setting:`EMAIL_USE_SSL`.
    
  1535. 
    
  1536. .. setting:: EMAIL_USE_SSL
    
  1537. 
    
  1538. ``EMAIL_USE_SSL``
    
  1539. -----------------
    
  1540. 
    
  1541. Default: ``False``
    
  1542. 
    
  1543. Whether to use an implicit TLS (secure) connection when talking to the SMTP
    
  1544. server. In most email documentation this type of TLS connection is referred
    
  1545. to as SSL. It is generally used on port 465. If you are experiencing problems,
    
  1546. see the explicit TLS setting :setting:`EMAIL_USE_TLS`.
    
  1547. 
    
  1548. Note that :setting:`EMAIL_USE_TLS`/:setting:`EMAIL_USE_SSL` are mutually
    
  1549. exclusive, so only set one of those settings to ``True``.
    
  1550. 
    
  1551. .. setting:: EMAIL_SSL_CERTFILE
    
  1552. 
    
  1553. ``EMAIL_SSL_CERTFILE``
    
  1554. ----------------------
    
  1555. 
    
  1556. Default: ``None``
    
  1557. 
    
  1558. If :setting:`EMAIL_USE_SSL` or :setting:`EMAIL_USE_TLS` is ``True``, you can
    
  1559. optionally specify the path to a PEM-formatted certificate chain file to use
    
  1560. for the SSL connection.
    
  1561. 
    
  1562. .. setting:: EMAIL_SSL_KEYFILE
    
  1563. 
    
  1564. ``EMAIL_SSL_KEYFILE``
    
  1565. ---------------------
    
  1566. 
    
  1567. Default: ``None``
    
  1568. 
    
  1569. If :setting:`EMAIL_USE_SSL` or :setting:`EMAIL_USE_TLS` is ``True``, you can
    
  1570. optionally specify the path to a PEM-formatted private key file to use for the
    
  1571. SSL connection.
    
  1572. 
    
  1573. Note that setting :setting:`EMAIL_SSL_CERTFILE` and :setting:`EMAIL_SSL_KEYFILE`
    
  1574. doesn't result in any certificate checking. They're passed to the underlying SSL
    
  1575. connection. Please refer to the documentation of Python's
    
  1576. :meth:`python:ssl.SSLContext.wrap_socket` function for details on how the
    
  1577. certificate chain file and private key file are handled.
    
  1578. 
    
  1579. .. setting:: EMAIL_TIMEOUT
    
  1580. 
    
  1581. ``EMAIL_TIMEOUT``
    
  1582. -----------------
    
  1583. 
    
  1584. Default: ``None``
    
  1585. 
    
  1586. Specifies a timeout in seconds for blocking operations like the connection
    
  1587. attempt.
    
  1588. 
    
  1589. .. setting:: FILE_UPLOAD_HANDLERS
    
  1590. 
    
  1591. ``FILE_UPLOAD_HANDLERS``
    
  1592. ------------------------
    
  1593. 
    
  1594. Default::
    
  1595. 
    
  1596.     [
    
  1597.         'django.core.files.uploadhandler.MemoryFileUploadHandler',
    
  1598.         'django.core.files.uploadhandler.TemporaryFileUploadHandler',
    
  1599.     ]
    
  1600. 
    
  1601. A list of handlers to use for uploading. Changing this setting allows complete
    
  1602. customization -- even replacement -- of Django's upload process.
    
  1603. 
    
  1604. See :doc:`/topics/files` for details.
    
  1605. 
    
  1606. .. setting:: FILE_UPLOAD_MAX_MEMORY_SIZE
    
  1607. 
    
  1608. ``FILE_UPLOAD_MAX_MEMORY_SIZE``
    
  1609. -------------------------------
    
  1610. 
    
  1611. Default: ``2621440`` (i.e. 2.5 MB).
    
  1612. 
    
  1613. The maximum size (in bytes) that an upload will be before it gets streamed to
    
  1614. the file system. See :doc:`/topics/files` for details.
    
  1615. 
    
  1616. See also :setting:`DATA_UPLOAD_MAX_MEMORY_SIZE`.
    
  1617. 
    
  1618. .. setting:: FILE_UPLOAD_DIRECTORY_PERMISSIONS
    
  1619. 
    
  1620. ``FILE_UPLOAD_DIRECTORY_PERMISSIONS``
    
  1621. -------------------------------------
    
  1622. 
    
  1623. Default: ``None``
    
  1624. 
    
  1625. The numeric mode to apply to directories created in the process of uploading
    
  1626. files.
    
  1627. 
    
  1628. This setting also determines the default permissions for collected static
    
  1629. directories when using the :djadmin:`collectstatic` management command. See
    
  1630. :djadmin:`collectstatic` for details on overriding it.
    
  1631. 
    
  1632. This value mirrors the functionality and caveats of the
    
  1633. :setting:`FILE_UPLOAD_PERMISSIONS` setting.
    
  1634. 
    
  1635. .. setting:: FILE_UPLOAD_PERMISSIONS
    
  1636. 
    
  1637. ``FILE_UPLOAD_PERMISSIONS``
    
  1638. ---------------------------
    
  1639. 
    
  1640. Default: ``0o644``
    
  1641. 
    
  1642. The numeric mode (i.e. ``0o644``) to set newly uploaded files to. For
    
  1643. more information about what these modes mean, see the documentation for
    
  1644. :func:`os.chmod`.
    
  1645. 
    
  1646. If ``None``, you'll get operating-system dependent behavior. On most platforms,
    
  1647. temporary files will have a mode of ``0o600``, and files saved from memory will
    
  1648. be saved using the system's standard umask.
    
  1649. 
    
  1650. For security reasons, these permissions aren't applied to the temporary files
    
  1651. that are stored in :setting:`FILE_UPLOAD_TEMP_DIR`.
    
  1652. 
    
  1653. This setting also determines the default permissions for collected static files
    
  1654. when using the :djadmin:`collectstatic` management command. See
    
  1655. :djadmin:`collectstatic` for details on overriding it.
    
  1656. 
    
  1657. .. warning::
    
  1658. 
    
  1659.     **Always prefix the mode with** ``0o`` **.**
    
  1660. 
    
  1661.     If you're not familiar with file modes, please note that the ``0o`` prefix
    
  1662.     is very important: it indicates an octal number, which is the way that
    
  1663.     modes must be specified. If you try to use ``644``, you'll get totally
    
  1664.     incorrect behavior.
    
  1665. 
    
  1666. .. setting:: FILE_UPLOAD_TEMP_DIR
    
  1667. 
    
  1668. ``FILE_UPLOAD_TEMP_DIR``
    
  1669. ------------------------
    
  1670. 
    
  1671. Default: ``None``
    
  1672. 
    
  1673. The directory to store data to (typically files larger than
    
  1674. :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`) temporarily while uploading files.
    
  1675. If ``None``, Django will use the standard temporary directory for the operating
    
  1676. system. For example, this will default to ``/tmp`` on \*nix-style operating
    
  1677. systems.
    
  1678. 
    
  1679. See :doc:`/topics/files` for details.
    
  1680. 
    
  1681. .. setting:: FIRST_DAY_OF_WEEK
    
  1682. 
    
  1683. ``FIRST_DAY_OF_WEEK``
    
  1684. ---------------------
    
  1685. 
    
  1686. Default: ``0`` (Sunday)
    
  1687. 
    
  1688. A number representing the first day of the week. This is especially useful
    
  1689. when displaying a calendar. This value is only used when not using
    
  1690. format internationalization, or when a format cannot be found for the
    
  1691. current locale.
    
  1692. 
    
  1693. The value must be an integer from 0 to 6, where 0 means Sunday, 1 means
    
  1694. Monday and so on.
    
  1695. 
    
  1696. .. setting:: FIXTURE_DIRS
    
  1697. 
    
  1698. ``FIXTURE_DIRS``
    
  1699. ----------------
    
  1700. 
    
  1701. Default: ``[]`` (Empty list)
    
  1702. 
    
  1703. List of directories searched for fixture files, in addition to the
    
  1704. ``fixtures`` directory of each application, in search order.
    
  1705. 
    
  1706. Note that these paths should use Unix-style forward slashes, even on Windows.
    
  1707. 
    
  1708. See :ref:`initial-data-via-fixtures` and :ref:`topics-testing-fixtures`.
    
  1709. 
    
  1710. .. setting:: FORCE_SCRIPT_NAME
    
  1711. 
    
  1712. ``FORCE_SCRIPT_NAME``
    
  1713. ---------------------
    
  1714. 
    
  1715. Default: ``None``
    
  1716. 
    
  1717. If not ``None``, this will be used as the value of the ``SCRIPT_NAME``
    
  1718. environment variable in any HTTP request. This setting can be used to override
    
  1719. the server-provided value of ``SCRIPT_NAME``, which may be a rewritten version
    
  1720. of the preferred value or not supplied at all. It is also used by
    
  1721. :func:`django.setup()` to set the URL resolver script prefix outside of the
    
  1722. request/response cycle (e.g. in management commands and standalone scripts) to
    
  1723. generate correct URLs when ``SCRIPT_NAME`` is not ``/``.
    
  1724. 
    
  1725. .. setting:: FORM_RENDERER
    
  1726. 
    
  1727. ``FORM_RENDERER``
    
  1728. -----------------
    
  1729. 
    
  1730. Default: ``'``:class:`django.forms.renderers.DjangoTemplates`\ ``'``
    
  1731. 
    
  1732. The class that renders forms and form widgets. It must implement
    
  1733. :ref:`the low-level render API <low-level-widget-render-api>`. Included form
    
  1734. renderers are:
    
  1735. 
    
  1736. * ``'``:class:`django.forms.renderers.DjangoTemplates`\ ``'``
    
  1737. * ``'``:class:`django.forms.renderers.Jinja2`\ ``'``
    
  1738. * ``'``:class:`django.forms.renderers.TemplatesSetting`\ ``'``
    
  1739. 
    
  1740. .. setting:: FORMAT_MODULE_PATH
    
  1741. 
    
  1742. ``FORMAT_MODULE_PATH``
    
  1743. ----------------------
    
  1744. 
    
  1745. Default: ``None``
    
  1746. 
    
  1747. A full Python path to a Python package that contains custom format definitions
    
  1748. for project locales. If not ``None``, Django will check for a ``formats.py``
    
  1749. file, under the directory named as the current locale, and will use the
    
  1750. formats defined in this file.
    
  1751. 
    
  1752. For example, if :setting:`FORMAT_MODULE_PATH` is set to ``mysite.formats``,
    
  1753. and current language is ``en`` (English), Django will expect a directory tree
    
  1754. like::
    
  1755. 
    
  1756.     mysite/
    
  1757.         formats/
    
  1758.             __init__.py
    
  1759.             en/
    
  1760.                 __init__.py
    
  1761.                 formats.py
    
  1762. 
    
  1763. You can also set this setting to a list of Python paths, for example::
    
  1764. 
    
  1765.     FORMAT_MODULE_PATH = [
    
  1766.         'mysite.formats',
    
  1767.         'some_app.formats',
    
  1768.     ]
    
  1769. 
    
  1770. When Django searches for a certain format, it will go through all given Python
    
  1771. paths until it finds a module that actually defines the given format. This
    
  1772. means that formats defined in packages farther up in the list will take
    
  1773. precedence over the same formats in packages farther down.
    
  1774. 
    
  1775. Available formats are:
    
  1776. 
    
  1777. * :setting:`DATE_FORMAT`
    
  1778. * :setting:`DATE_INPUT_FORMATS`
    
  1779. * :setting:`DATETIME_FORMAT`,
    
  1780. * :setting:`DATETIME_INPUT_FORMATS`
    
  1781. * :setting:`DECIMAL_SEPARATOR`
    
  1782. * :setting:`FIRST_DAY_OF_WEEK`
    
  1783. * :setting:`MONTH_DAY_FORMAT`
    
  1784. * :setting:`NUMBER_GROUPING`
    
  1785. * :setting:`SHORT_DATE_FORMAT`
    
  1786. * :setting:`SHORT_DATETIME_FORMAT`
    
  1787. * :setting:`THOUSAND_SEPARATOR`
    
  1788. * :setting:`TIME_FORMAT`
    
  1789. * :setting:`TIME_INPUT_FORMATS`
    
  1790. * :setting:`YEAR_MONTH_FORMAT`
    
  1791. 
    
  1792. .. setting:: IGNORABLE_404_URLS
    
  1793. 
    
  1794. ``IGNORABLE_404_URLS``
    
  1795. ----------------------
    
  1796. 
    
  1797. Default: ``[]`` (Empty list)
    
  1798. 
    
  1799. List of compiled regular expression objects describing URLs that should be
    
  1800. ignored when reporting HTTP 404 errors via email (see
    
  1801. :doc:`/howto/error-reporting`). Regular expressions are matched against
    
  1802. :meth:`request's full paths <django.http.HttpRequest.get_full_path>` (including
    
  1803. query string, if any). Use this if your site does not provide a commonly
    
  1804. requested file such as ``favicon.ico`` or ``robots.txt``.
    
  1805. 
    
  1806. This is only used if
    
  1807. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled (see
    
  1808. :doc:`/topics/http/middleware`).
    
  1809. 
    
  1810. .. setting:: INSTALLED_APPS
    
  1811. 
    
  1812. ``INSTALLED_APPS``
    
  1813. ------------------
    
  1814. 
    
  1815. Default: ``[]`` (Empty list)
    
  1816. 
    
  1817. A list of strings designating all applications that are enabled in this
    
  1818. Django installation. Each string should be a dotted Python path to:
    
  1819. 
    
  1820. * an application configuration class (preferred), or
    
  1821. * a package containing an application.
    
  1822. 
    
  1823. :doc:`Learn more about application configurations </ref/applications>`.
    
  1824. 
    
  1825. .. admonition:: Use the application registry for introspection
    
  1826. 
    
  1827.     Your code should never access :setting:`INSTALLED_APPS` directly. Use
    
  1828.     :attr:`django.apps.apps` instead.
    
  1829. 
    
  1830. .. admonition:: Application names and labels must be unique in
    
  1831.                 :setting:`INSTALLED_APPS`
    
  1832. 
    
  1833.     Application :attr:`names <django.apps.AppConfig.name>` — the dotted Python
    
  1834.     path to the application package — must be unique. There is no way to
    
  1835.     include the same application twice, short of duplicating its code under
    
  1836.     another name.
    
  1837. 
    
  1838.     Application :attr:`labels <django.apps.AppConfig.label>` — by default the
    
  1839.     final part of the name — must be unique too. For example, you can't
    
  1840.     include both ``django.contrib.auth`` and ``myproject.auth``. However, you
    
  1841.     can relabel an application with a custom configuration that defines a
    
  1842.     different :attr:`~django.apps.AppConfig.label`.
    
  1843. 
    
  1844.     These rules apply regardless of whether :setting:`INSTALLED_APPS`
    
  1845.     references application configuration classes or application packages.
    
  1846. 
    
  1847. When several applications provide different versions of the same resource
    
  1848. (template, static file, management command, translation), the application
    
  1849. listed first in :setting:`INSTALLED_APPS` has precedence.
    
  1850. 
    
  1851. .. setting:: INTERNAL_IPS
    
  1852. 
    
  1853. ``INTERNAL_IPS``
    
  1854. ----------------
    
  1855. 
    
  1856. Default: ``[]`` (Empty list)
    
  1857. 
    
  1858. A list of IP addresses, as strings, that:
    
  1859. 
    
  1860. * Allow the :func:`~django.template.context_processors.debug` context processor
    
  1861.   to add some variables to the template context.
    
  1862. * Can use the :ref:`admindocs bookmarklets <admindocs-bookmarklets>` even if
    
  1863.   not logged in as a staff user.
    
  1864. * Are marked as "internal" (as opposed to "EXTERNAL") in
    
  1865.   :class:`~django.utils.log.AdminEmailHandler` emails.
    
  1866. 
    
  1867. .. setting:: LANGUAGE_CODE
    
  1868. 
    
  1869. ``LANGUAGE_CODE``
    
  1870. -----------------
    
  1871. 
    
  1872. Default: ``'en-us'``
    
  1873. 
    
  1874. A string representing the language code for this installation. This should be in
    
  1875. standard :term:`language ID format <language code>`. For example, U.S. English
    
  1876. is ``"en-us"``. See also the `list of language identifiers`_ and
    
  1877. :doc:`/topics/i18n/index`.
    
  1878. 
    
  1879. :setting:`USE_I18N` must be active for this setting to have any effect.
    
  1880. 
    
  1881. It serves two purposes:
    
  1882. 
    
  1883. * If the locale middleware isn't in use, it decides which translation is served
    
  1884.   to all users.
    
  1885. * If the locale middleware is active, it provides a fallback language in case the
    
  1886.   user's preferred language can't be determined or is not supported by the
    
  1887.   website. It also provides the fallback translation when a translation for a
    
  1888.   given literal doesn't exist for the user's preferred language.
    
  1889. 
    
  1890. See :ref:`how-django-discovers-language-preference` for more details.
    
  1891. 
    
  1892. .. _list of language identifiers: http://www.i18nguy.com/unicode/language-identifiers.html
    
  1893. 
    
  1894. .. setting:: LANGUAGE_COOKIE_AGE
    
  1895. 
    
  1896. ``LANGUAGE_COOKIE_AGE``
    
  1897. -----------------------
    
  1898. 
    
  1899. Default: ``None`` (expires at browser close)
    
  1900. 
    
  1901. The age of the language cookie, in seconds.
    
  1902. 
    
  1903. .. setting:: LANGUAGE_COOKIE_DOMAIN
    
  1904. 
    
  1905. ``LANGUAGE_COOKIE_DOMAIN``
    
  1906. --------------------------
    
  1907. 
    
  1908. Default: ``None``
    
  1909. 
    
  1910. The domain to use for the language cookie. Set this to a string such as
    
  1911. ``"example.com"`` for cross-domain cookies, or use ``None`` for a standard
    
  1912. domain cookie.
    
  1913. 
    
  1914. Be cautious when updating this setting on a production site. If you update
    
  1915. this setting to enable cross-domain cookies on a site that previously used
    
  1916. standard domain cookies, existing user cookies that have the old domain
    
  1917. will not be updated. This will result in site users being unable to switch
    
  1918. the language as long as these cookies persist. The only safe and reliable
    
  1919. option to perform the switch is to change the language cookie name
    
  1920. permanently (via the :setting:`LANGUAGE_COOKIE_NAME` setting) and to add
    
  1921. a middleware that copies the value from the old cookie to a new one and then
    
  1922. deletes the old one.
    
  1923. 
    
  1924. .. setting:: LANGUAGE_COOKIE_HTTPONLY
    
  1925. 
    
  1926. ``LANGUAGE_COOKIE_HTTPONLY``
    
  1927. ----------------------------
    
  1928. 
    
  1929. Default: ``False``
    
  1930. 
    
  1931. Whether to use ``HttpOnly`` flag on the language cookie. If this is set to
    
  1932. ``True``, client-side JavaScript will not be able to access the language
    
  1933. cookie.
    
  1934. 
    
  1935. See :setting:`SESSION_COOKIE_HTTPONLY` for details on ``HttpOnly``.
    
  1936. 
    
  1937. .. setting:: LANGUAGE_COOKIE_NAME
    
  1938. 
    
  1939. ``LANGUAGE_COOKIE_NAME``
    
  1940. ------------------------
    
  1941. 
    
  1942. Default: ``'django_language'``
    
  1943. 
    
  1944. The name of the cookie to use for the language cookie. This can be whatever
    
  1945. you want (as long as it's different from the other cookie names in your
    
  1946. application). See :doc:`/topics/i18n/index`.
    
  1947. 
    
  1948. .. setting:: LANGUAGE_COOKIE_PATH
    
  1949. 
    
  1950. ``LANGUAGE_COOKIE_PATH``
    
  1951. ------------------------
    
  1952. 
    
  1953. Default: ``'/'``
    
  1954. 
    
  1955. The path set on the language cookie. This should either match the URL path of your
    
  1956. Django installation or be a parent of that path.
    
  1957. 
    
  1958. This is useful if you have multiple Django instances running under the same
    
  1959. hostname. They can use different cookie paths and each instance will only see
    
  1960. its own language cookie.
    
  1961. 
    
  1962. Be cautious when updating this setting on a production site. If you update this
    
  1963. setting to use a deeper path than it previously used, existing user cookies that
    
  1964. have the old path will not be updated. This will result in site users being
    
  1965. unable to switch the language as long as these cookies persist. The only safe
    
  1966. and reliable option to perform the switch is to change the language cookie name
    
  1967. permanently (via the :setting:`LANGUAGE_COOKIE_NAME` setting), and to add
    
  1968. a middleware that copies the value from the old cookie to a new one and then
    
  1969. deletes the one.
    
  1970. 
    
  1971. .. setting:: LANGUAGE_COOKIE_SAMESITE
    
  1972. 
    
  1973. ``LANGUAGE_COOKIE_SAMESITE``
    
  1974. ----------------------------
    
  1975. 
    
  1976. Default: ``None``
    
  1977. 
    
  1978. The value of the `SameSite`_ flag on the language cookie. This flag prevents the
    
  1979. cookie from being sent in cross-site requests.
    
  1980. 
    
  1981. See :setting:`SESSION_COOKIE_SAMESITE` for details about ``SameSite``.
    
  1982. 
    
  1983. .. setting:: LANGUAGE_COOKIE_SECURE
    
  1984. 
    
  1985. ``LANGUAGE_COOKIE_SECURE``
    
  1986. --------------------------
    
  1987. 
    
  1988. Default: ``False``
    
  1989. 
    
  1990. Whether to use a secure cookie for the language cookie. If this is set to
    
  1991. ``True``, the cookie will be marked as "secure", which means browsers may
    
  1992. ensure that the cookie is only sent under an HTTPS connection.
    
  1993. 
    
  1994. .. setting:: LANGUAGES
    
  1995. 
    
  1996. ``LANGUAGES``
    
  1997. -------------
    
  1998. 
    
  1999. Default: A list of all available languages. This list is continually growing
    
  2000. and including a copy here would inevitably become rapidly out of date. You can
    
  2001. see the current list of translated languages by looking in
    
  2002. :source:`django/conf/global_settings.py`.
    
  2003. 
    
  2004. The list is a list of two-tuples in the format
    
  2005. (:term:`language code<language code>`, ``language name``) -- for example,
    
  2006. ``('ja', 'Japanese')``.
    
  2007. This specifies which languages are available for language selection. See
    
  2008. :doc:`/topics/i18n/index`.
    
  2009. 
    
  2010. Generally, the default value should suffice. Only set this setting if you want
    
  2011. to restrict language selection to a subset of the Django-provided languages.
    
  2012. 
    
  2013. If you define a custom :setting:`LANGUAGES` setting, you can mark the
    
  2014. language names as translation strings using the
    
  2015. :func:`~django.utils.translation.gettext_lazy` function.
    
  2016. 
    
  2017. Here's a sample settings file::
    
  2018. 
    
  2019.     from django.utils.translation import gettext_lazy as _
    
  2020. 
    
  2021.     LANGUAGES = [
    
  2022.         ('de', _('German')),
    
  2023.         ('en', _('English')),
    
  2024.     ]
    
  2025. 
    
  2026. .. setting:: LANGUAGES_BIDI
    
  2027. 
    
  2028. ``LANGUAGES_BIDI``
    
  2029. ------------------
    
  2030. 
    
  2031. Default: A list of all language codes that are written right-to-left. You can
    
  2032. see the current list of these languages by looking in
    
  2033. :source:`django/conf/global_settings.py`.
    
  2034. 
    
  2035. The list contains :term:`language codes<language code>` for languages that are
    
  2036. written right-to-left.
    
  2037. 
    
  2038. Generally, the default value should suffice. Only set this setting if you want
    
  2039. to restrict language selection to a subset of the Django-provided languages.
    
  2040. If you define a custom :setting:`LANGUAGES` setting, the list of bidirectional
    
  2041. languages may contain language codes which are not enabled on a given site.
    
  2042. 
    
  2043. .. setting:: LOCALE_PATHS
    
  2044. 
    
  2045. ``LOCALE_PATHS``
    
  2046. ----------------
    
  2047. 
    
  2048. Default: ``[]`` (Empty list)
    
  2049. 
    
  2050. A list of directories where Django looks for translation files.
    
  2051. See :ref:`how-django-discovers-translations`.
    
  2052. 
    
  2053. Example::
    
  2054. 
    
  2055.     LOCALE_PATHS = [
    
  2056.         '/home/www/project/common_files/locale',
    
  2057.         '/var/local/translations/locale',
    
  2058.     ]
    
  2059. 
    
  2060. Django will look within each of these paths for the ``<locale_code>/LC_MESSAGES``
    
  2061. directories containing the actual translation files.
    
  2062. 
    
  2063. .. setting:: LOGGING
    
  2064. 
    
  2065. ``LOGGING``
    
  2066. -----------
    
  2067. 
    
  2068. Default: A logging configuration dictionary.
    
  2069. 
    
  2070. A data structure containing configuration information. When not-empty, the
    
  2071. contents of this data structure will be passed as the argument to the
    
  2072. configuration method described in :setting:`LOGGING_CONFIG`.
    
  2073. 
    
  2074. Among other things, the default logging configuration passes HTTP 500 server
    
  2075. errors to an email log handler when :setting:`DEBUG` is ``False``. See also
    
  2076. :ref:`configuring-logging`.
    
  2077. 
    
  2078. You can see the default logging configuration by looking in
    
  2079. :source:`django/utils/log.py`.
    
  2080. 
    
  2081. .. setting:: LOGGING_CONFIG
    
  2082. 
    
  2083. ``LOGGING_CONFIG``
    
  2084. ------------------
    
  2085. 
    
  2086. Default: ``'logging.config.dictConfig'``
    
  2087. 
    
  2088. A path to a callable that will be used to configure logging in the
    
  2089. Django project. Points at an instance of Python's :ref:`dictConfig
    
  2090. <logging-config-dictschema>` configuration method by default.
    
  2091. 
    
  2092. If you set :setting:`LOGGING_CONFIG` to ``None``, the logging
    
  2093. configuration process will be skipped.
    
  2094. 
    
  2095. .. setting:: MANAGERS
    
  2096. 
    
  2097. ``MANAGERS``
    
  2098. ------------
    
  2099. 
    
  2100. Default: ``[]`` (Empty list)
    
  2101. 
    
  2102. A list in the same format as :setting:`ADMINS` that specifies who should get
    
  2103. broken link notifications when
    
  2104. :class:`~django.middleware.common.BrokenLinkEmailsMiddleware` is enabled.
    
  2105. 
    
  2106. .. setting:: MEDIA_ROOT
    
  2107. 
    
  2108. ``MEDIA_ROOT``
    
  2109. --------------
    
  2110. 
    
  2111. Default: ``''`` (Empty string)
    
  2112. 
    
  2113. Absolute filesystem path to the directory that will hold :doc:`user-uploaded
    
  2114. files </topics/files>`.
    
  2115. 
    
  2116. Example: ``"/var/www/example.com/media/"``
    
  2117. 
    
  2118. See also :setting:`MEDIA_URL`.
    
  2119. 
    
  2120. .. warning::
    
  2121. 
    
  2122.     :setting:`MEDIA_ROOT` and :setting:`STATIC_ROOT` must have different
    
  2123.     values. Before :setting:`STATIC_ROOT` was introduced, it was common to
    
  2124.     rely or fallback on :setting:`MEDIA_ROOT` to also serve static files;
    
  2125.     however, since this can have serious security implications, there is a
    
  2126.     validation check to prevent it.
    
  2127. 
    
  2128. .. setting:: MEDIA_URL
    
  2129. 
    
  2130. ``MEDIA_URL``
    
  2131. -------------
    
  2132. 
    
  2133. Default: ``''`` (Empty string)
    
  2134. 
    
  2135. URL that handles the media served from :setting:`MEDIA_ROOT`, used
    
  2136. for :doc:`managing stored files </topics/files>`. It must end in a slash if set
    
  2137. to a non-empty value. You will need to :ref:`configure these files to be served
    
  2138. <serving-uploaded-files-in-development>` in both development and production
    
  2139. environments.
    
  2140. 
    
  2141. If you want to use ``{{ MEDIA_URL }}`` in your templates, add
    
  2142. ``'django.template.context_processors.media'`` in the ``'context_processors'``
    
  2143. option of :setting:`TEMPLATES`.
    
  2144. 
    
  2145. Example: ``"http://media.example.com/"``
    
  2146. 
    
  2147. .. warning::
    
  2148. 
    
  2149.     There are security risks if you are accepting uploaded content from
    
  2150.     untrusted users! See the security guide's topic on
    
  2151.     :ref:`user-uploaded-content-security` for mitigation details.
    
  2152. 
    
  2153. .. warning::
    
  2154. 
    
  2155.     :setting:`MEDIA_URL` and :setting:`STATIC_URL` must have different
    
  2156.     values. See :setting:`MEDIA_ROOT` for more details.
    
  2157. 
    
  2158. .. note::
    
  2159. 
    
  2160.     If :setting:`MEDIA_URL` is a relative path, then it will be prefixed by the
    
  2161.     server-provided value of ``SCRIPT_NAME`` (or ``/`` if not set). This makes
    
  2162.     it easier to serve a Django application in a subpath without adding an
    
  2163.     extra configuration to the settings.
    
  2164. 
    
  2165. .. setting:: MIDDLEWARE
    
  2166. 
    
  2167. ``MIDDLEWARE``
    
  2168. --------------
    
  2169. 
    
  2170. Default: ``None``
    
  2171. 
    
  2172. A list of middleware to use. See :doc:`/topics/http/middleware`.
    
  2173. 
    
  2174. .. setting:: MIGRATION_MODULES
    
  2175. 
    
  2176. ``MIGRATION_MODULES``
    
  2177. ---------------------
    
  2178. 
    
  2179. Default: ``{}`` (Empty dictionary)
    
  2180. 
    
  2181. A dictionary specifying the package where migration modules can be found on a
    
  2182. per-app basis. The default value of this setting is an empty dictionary, but
    
  2183. the default package name for migration modules is ``migrations``.
    
  2184. 
    
  2185. Example::
    
  2186. 
    
  2187.     {'blog': 'blog.db_migrations'}
    
  2188. 
    
  2189. In this case, migrations pertaining to the ``blog`` app will be contained in
    
  2190. the ``blog.db_migrations`` package.
    
  2191. 
    
  2192. If you provide the ``app_label`` argument, :djadmin:`makemigrations` will
    
  2193. automatically create the package if it doesn't already exist.
    
  2194. 
    
  2195. When you supply ``None`` as a value for an app, Django will consider the app as
    
  2196. an app without migrations regardless of an existing ``migrations`` submodule.
    
  2197. This can be used, for example, in a test settings file to skip migrations while
    
  2198. testing (tables will still be created for the apps' models). To disable
    
  2199. migrations for all apps during tests, you can set the
    
  2200. :setting:`MIGRATE <TEST_MIGRATE>` to ``False`` instead. If
    
  2201. ``MIGRATION_MODULES`` is used in your general project settings, remember to use
    
  2202. the :option:`migrate --run-syncdb` option if you want to create tables for the
    
  2203. app.
    
  2204. 
    
  2205. .. setting:: MONTH_DAY_FORMAT
    
  2206. 
    
  2207. ``MONTH_DAY_FORMAT``
    
  2208. --------------------
    
  2209. 
    
  2210. Default: ``'F j'``
    
  2211. 
    
  2212. The default formatting to use for date fields on Django admin change-list
    
  2213. pages -- and, possibly, by other parts of the system -- in cases when only the
    
  2214. month and day are displayed.
    
  2215. 
    
  2216. For example, when a Django admin change-list page is being filtered by a date
    
  2217. drilldown, the header for a given day displays the day and month. Different
    
  2218. locales have different formats. For example, U.S. English would say
    
  2219. "January 1," whereas Spanish might say "1 Enero."
    
  2220. 
    
  2221. Note that if :setting:`USE_L10N` is set to ``True``, then the corresponding
    
  2222. locale-dictated format has higher precedence and will be applied.
    
  2223. 
    
  2224. See :tfilter:`allowed date format strings <date>`. See also
    
  2225. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`,
    
  2226. :setting:`TIME_FORMAT` and :setting:`YEAR_MONTH_FORMAT`.
    
  2227. 
    
  2228. .. setting:: NUMBER_GROUPING
    
  2229. 
    
  2230. ``NUMBER_GROUPING``
    
  2231. -------------------
    
  2232. 
    
  2233. Default: ``0``
    
  2234. 
    
  2235. Number of digits grouped together on the integer part of a number.
    
  2236. 
    
  2237. Common use is to display a thousand separator. If this setting is ``0``, then
    
  2238. no grouping will be applied to the number. If this setting is greater than
    
  2239. ``0``, then :setting:`THOUSAND_SEPARATOR` will be used as the separator between
    
  2240. those groups.
    
  2241. 
    
  2242. Some locales use non-uniform digit grouping, e.g. ``10,00,00,000`` in
    
  2243. ``en_IN``. For this case, you can provide a sequence with the number of digit
    
  2244. group sizes to be applied. The first number defines the size of the group
    
  2245. preceding the decimal delimiter, and each number that follows defines the size
    
  2246. of preceding groups. If the sequence is terminated with ``-1``, no further
    
  2247. grouping is performed. If the sequence terminates with a ``0``, the last group
    
  2248. size is used for the remainder of the number.
    
  2249. 
    
  2250. Example tuple for ``en_IN``::
    
  2251. 
    
  2252.     NUMBER_GROUPING = (3, 2, 0)
    
  2253. 
    
  2254. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
    
  2255. format has higher precedence and will be applied instead.
    
  2256. 
    
  2257. See also :setting:`DECIMAL_SEPARATOR`, :setting:`THOUSAND_SEPARATOR` and
    
  2258. :setting:`USE_THOUSAND_SEPARATOR`.
    
  2259. 
    
  2260. .. setting:: PREPEND_WWW
    
  2261. 
    
  2262. ``PREPEND_WWW``
    
  2263. ---------------
    
  2264. 
    
  2265. Default: ``False``
    
  2266. 
    
  2267. Whether to prepend the "www." subdomain to URLs that don't have it. This is only
    
  2268. used if :class:`~django.middleware.common.CommonMiddleware` is installed
    
  2269. (see :doc:`/topics/http/middleware`). See also :setting:`APPEND_SLASH`.
    
  2270. 
    
  2271. .. setting:: ROOT_URLCONF
    
  2272. 
    
  2273. ``ROOT_URLCONF``
    
  2274. ----------------
    
  2275. 
    
  2276. Default: Not defined
    
  2277. 
    
  2278. A string representing the full Python import path to your root URLconf, for
    
  2279. example ``"mydjangoapps.urls"``. Can be overridden on a per-request basis by
    
  2280. setting the attribute ``urlconf`` on the incoming ``HttpRequest``
    
  2281. object. See :ref:`how-django-processes-a-request` for details.
    
  2282. 
    
  2283. .. setting:: SECRET_KEY
    
  2284. 
    
  2285. ``SECRET_KEY``
    
  2286. --------------
    
  2287. 
    
  2288. Default: ``''`` (Empty string)
    
  2289. 
    
  2290. A secret key for a particular Django installation. This is used to provide
    
  2291. :doc:`cryptographic signing </topics/signing>`, and should be set to a unique,
    
  2292. unpredictable value.
    
  2293. 
    
  2294. :djadmin:`django-admin startproject <startproject>` automatically adds a
    
  2295. randomly-generated ``SECRET_KEY`` to each new project.
    
  2296. 
    
  2297. Uses of the key shouldn't assume that it's text or bytes. Every use should go
    
  2298. through :func:`~django.utils.encoding.force_str` or
    
  2299. :func:`~django.utils.encoding.force_bytes` to convert it to the desired type.
    
  2300. 
    
  2301. Django will refuse to start if :setting:`SECRET_KEY` is not set.
    
  2302. 
    
  2303. .. warning::
    
  2304. 
    
  2305.     **Keep this value secret.**
    
  2306. 
    
  2307.     Running Django with a known :setting:`SECRET_KEY` defeats many of Django's
    
  2308.     security protections, and can lead to privilege escalation and remote code
    
  2309.     execution vulnerabilities.
    
  2310. 
    
  2311. The secret key is used for:
    
  2312. 
    
  2313. * All :doc:`sessions </topics/http/sessions>` if you are using
    
  2314.   any other session backend than ``django.contrib.sessions.backends.cache``,
    
  2315.   or are using the default
    
  2316.   :meth:`~django.contrib.auth.models.AbstractBaseUser.get_session_auth_hash()`.
    
  2317. * All :doc:`messages </ref/contrib/messages>` if you are using
    
  2318.   :class:`~django.contrib.messages.storage.cookie.CookieStorage` or
    
  2319.   :class:`~django.contrib.messages.storage.fallback.FallbackStorage`.
    
  2320. * All :class:`~django.contrib.auth.views.PasswordResetView` tokens.
    
  2321. * Any usage of :doc:`cryptographic signing </topics/signing>`, unless a
    
  2322.   different key is provided.
    
  2323. 
    
  2324. When a secret key is no longer set as :setting:`SECRET_KEY` or contained within
    
  2325. :setting:`SECRET_KEY_FALLBACKS` all of the above will be invalidated. When
    
  2326. rotating your secret key, you should move the old key to
    
  2327. :setting:`SECRET_KEY_FALLBACKS` temporarily. Secret keys are not used for
    
  2328. passwords of users and key rotation will not affect them.
    
  2329. 
    
  2330. .. note::
    
  2331. 
    
  2332.     The default :file:`settings.py` file created by :djadmin:`django-admin
    
  2333.     startproject <startproject>` creates a unique ``SECRET_KEY`` for
    
  2334.     convenience.
    
  2335. 
    
  2336. .. setting:: SECRET_KEY_FALLBACKS
    
  2337. 
    
  2338. ``SECRET_KEY_FALLBACKS``
    
  2339. ------------------------
    
  2340. 
    
  2341. .. versionadded:: 4.1
    
  2342. 
    
  2343. Default: ``[]``
    
  2344. 
    
  2345. A list of fallback secret keys for a particular Django installation. These are
    
  2346. used to allow rotation of the ``SECRET_KEY``.
    
  2347. 
    
  2348. In order to rotate your secret keys, set a new ``SECRET_KEY`` and move the
    
  2349. previous value to the beginning of ``SECRET_KEY_FALLBACKS``. Then remove the
    
  2350. old values from the end of the ``SECRET_KEY_FALLBACKS`` when you are ready to
    
  2351. expire the sessions, password reset tokens, and so on, that make use of them.
    
  2352. 
    
  2353. .. note::
    
  2354. 
    
  2355.     Signing operations are computationally expensive. Having multiple old key
    
  2356.     values in ``SECRET_KEY_FALLBACKS`` adds additional overhead to all checks
    
  2357.     that don't match an earlier key.
    
  2358. 
    
  2359.     As such, fallback values should be removed after an appropriate period,
    
  2360.     allowing for key rotation.
    
  2361. 
    
  2362. Uses of the secret key values shouldn't assume that they are text or bytes.
    
  2363. Every use should go through :func:`~django.utils.encoding.force_str` or
    
  2364. :func:`~django.utils.encoding.force_bytes` to convert it to the desired type.
    
  2365. 
    
  2366. .. setting:: SECURE_CONTENT_TYPE_NOSNIFF
    
  2367. 
    
  2368. ``SECURE_CONTENT_TYPE_NOSNIFF``
    
  2369. -------------------------------
    
  2370. 
    
  2371. Default: ``True``
    
  2372. 
    
  2373. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware`
    
  2374. sets the :ref:`x-content-type-options` header on all responses that do not
    
  2375. already have it.
    
  2376. 
    
  2377. .. setting:: SECURE_CROSS_ORIGIN_OPENER_POLICY
    
  2378. 
    
  2379. ``SECURE_CROSS_ORIGIN_OPENER_POLICY``
    
  2380. -------------------------------------
    
  2381. 
    
  2382. .. versionadded:: 4.0
    
  2383. 
    
  2384. Default: ``'same-origin'``
    
  2385. 
    
  2386. Unless set to ``None``, the
    
  2387. :class:`~django.middleware.security.SecurityMiddleware` sets the
    
  2388. :ref:`cross-origin-opener-policy` header on all responses that do not already
    
  2389. have it to the value provided.
    
  2390. 
    
  2391. .. setting:: SECURE_HSTS_INCLUDE_SUBDOMAINS
    
  2392. 
    
  2393. ``SECURE_HSTS_INCLUDE_SUBDOMAINS``
    
  2394. ----------------------------------
    
  2395. 
    
  2396. Default: ``False``
    
  2397. 
    
  2398. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware` adds
    
  2399. the ``includeSubDomains`` directive to the :ref:`http-strict-transport-security`
    
  2400. header. It has no effect unless :setting:`SECURE_HSTS_SECONDS` is set to a
    
  2401. non-zero value.
    
  2402. 
    
  2403. .. warning::
    
  2404.     Setting this incorrectly can irreversibly (for the value of
    
  2405.     :setting:`SECURE_HSTS_SECONDS`) break your site. Read the
    
  2406.     :ref:`http-strict-transport-security` documentation first.
    
  2407. 
    
  2408. .. setting:: SECURE_HSTS_PRELOAD
    
  2409. 
    
  2410. ``SECURE_HSTS_PRELOAD``
    
  2411. -----------------------
    
  2412. 
    
  2413. Default: ``False``
    
  2414. 
    
  2415. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware` adds
    
  2416. the ``preload`` directive to the :ref:`http-strict-transport-security`
    
  2417. header. It has no effect unless :setting:`SECURE_HSTS_SECONDS` is set to a
    
  2418. non-zero value.
    
  2419. 
    
  2420. .. setting:: SECURE_HSTS_SECONDS
    
  2421. 
    
  2422. ``SECURE_HSTS_SECONDS``
    
  2423. -----------------------
    
  2424. 
    
  2425. Default: ``0``
    
  2426. 
    
  2427. If set to a non-zero integer value, the
    
  2428. :class:`~django.middleware.security.SecurityMiddleware` sets the
    
  2429. :ref:`http-strict-transport-security` header on all responses that do not
    
  2430. already have it.
    
  2431. 
    
  2432. .. warning::
    
  2433.     Setting this incorrectly can irreversibly (for some time) break your site.
    
  2434.     Read the :ref:`http-strict-transport-security` documentation first.
    
  2435. 
    
  2436. .. setting:: SECURE_PROXY_SSL_HEADER
    
  2437. 
    
  2438. ``SECURE_PROXY_SSL_HEADER``
    
  2439. ---------------------------
    
  2440. 
    
  2441. Default: ``None``
    
  2442. 
    
  2443. A tuple representing an HTTP header/value combination that signifies a request
    
  2444. is secure. This controls the behavior of the request object's ``is_secure()``
    
  2445. method.
    
  2446. 
    
  2447. By default, ``is_secure()`` determines if a request is secure by confirming
    
  2448. that a requested URL uses ``https://``. This method is important for Django's
    
  2449. CSRF protection, and it may be used by your own code or third-party apps.
    
  2450. 
    
  2451. If your Django app is behind a proxy, though, the proxy may be "swallowing"
    
  2452. whether the original request uses HTTPS or not. If there is a non-HTTPS
    
  2453. connection between the proxy and Django then ``is_secure()`` would always
    
  2454. return ``False`` -- even for requests that were made via HTTPS by the end user.
    
  2455. In contrast, if there is an HTTPS connection between the proxy and Django then
    
  2456. ``is_secure()`` would always return ``True`` -- even for requests that were
    
  2457. made originally via HTTP.
    
  2458. 
    
  2459. In this situation, configure your proxy to set a custom HTTP header that tells
    
  2460. Django whether the request came in via HTTPS, and set
    
  2461. ``SECURE_PROXY_SSL_HEADER`` so that Django knows what header to look for.
    
  2462. 
    
  2463. Set a tuple with two elements -- the name of the header to look for and the
    
  2464. required value. For example::
    
  2465. 
    
  2466.     SECURE_PROXY_SSL_HEADER = ('HTTP_X_FORWARDED_PROTO', 'https')
    
  2467. 
    
  2468. This tells Django to trust the ``X-Forwarded-Proto`` header that comes from our
    
  2469. proxy and that the request is guaranteed to be secure (i.e., it originally came
    
  2470. in via HTTPS) when:
    
  2471. 
    
  2472. * the header value is ``'https'``, or
    
  2473. * its initial, leftmost value is ``'https'`` in the case of a comma-separated
    
  2474.   list of protocols (e.g. ``'https,http,http'``).
    
  2475. 
    
  2476. .. versionchanged:: 4.1
    
  2477. 
    
  2478.     Support for a comma-separated list of protocols in the header value was
    
  2479.     added.
    
  2480. 
    
  2481. You should *only* set this setting if you control your proxy or have some other
    
  2482. guarantee that it sets/strips this header appropriately.
    
  2483. 
    
  2484. Note that the header needs to be in the format as used by ``request.META`` --
    
  2485. all caps and likely starting with ``HTTP_``. (Remember, Django automatically
    
  2486. adds ``'HTTP_'`` to the start of x-header names before making the header
    
  2487. available in ``request.META``.)
    
  2488. 
    
  2489. .. warning::
    
  2490. 
    
  2491.     **Modifying this setting can compromise your site's security. Ensure you
    
  2492.     fully understand your setup before changing it.**
    
  2493. 
    
  2494.     Make sure ALL of the following are true before setting this (assuming the
    
  2495.     values from the example above):
    
  2496. 
    
  2497.     * Your Django app is behind a proxy.
    
  2498.     * Your proxy strips the ``X-Forwarded-Proto`` header from all incoming
    
  2499.       requests, even when it contains a comma-separated list of protocols. In
    
  2500.       other words, if end users include that header in their requests, the
    
  2501.       proxy will discard it.
    
  2502.     * Your proxy sets the ``X-Forwarded-Proto`` header and sends it to Django,
    
  2503.       but only for requests that originally come in via HTTPS.
    
  2504. 
    
  2505.     If any of those are not true, you should keep this setting set to ``None``
    
  2506.     and find another way of determining HTTPS, perhaps via custom middleware.
    
  2507. 
    
  2508. .. setting:: SECURE_REDIRECT_EXEMPT
    
  2509. 
    
  2510. ``SECURE_REDIRECT_EXEMPT``
    
  2511. --------------------------
    
  2512. 
    
  2513. Default: ``[]`` (Empty list)
    
  2514. 
    
  2515. If a URL path matches a regular expression in this list, the request will not be
    
  2516. redirected to HTTPS. The
    
  2517. :class:`~django.middleware.security.SecurityMiddleware` strips leading slashes
    
  2518. from URL paths, so patterns shouldn't include them, e.g.
    
  2519. ``SECURE_REDIRECT_EXEMPT = [r'^no-ssl/$', …]``. If
    
  2520. :setting:`SECURE_SSL_REDIRECT` is ``False``, this setting has no effect.
    
  2521. 
    
  2522. .. setting:: SECURE_REFERRER_POLICY
    
  2523. 
    
  2524. ``SECURE_REFERRER_POLICY``
    
  2525. --------------------------
    
  2526. 
    
  2527. Default: ``'same-origin'``
    
  2528. 
    
  2529. If configured, the :class:`~django.middleware.security.SecurityMiddleware` sets
    
  2530. the :ref:`referrer-policy` header on all responses that do not already have it
    
  2531. to the value provided.
    
  2532. 
    
  2533. .. setting:: SECURE_SSL_HOST
    
  2534. 
    
  2535. ``SECURE_SSL_HOST``
    
  2536. -------------------
    
  2537. 
    
  2538. Default: ``None``
    
  2539. 
    
  2540. If a string (e.g. ``secure.example.com``), all SSL redirects will be directed
    
  2541. to this host rather than the originally-requested host
    
  2542. (e.g. ``www.example.com``). If :setting:`SECURE_SSL_REDIRECT` is ``False``, this
    
  2543. setting has no effect.
    
  2544. 
    
  2545. .. setting:: SECURE_SSL_REDIRECT
    
  2546. 
    
  2547. ``SECURE_SSL_REDIRECT``
    
  2548. -----------------------
    
  2549. 
    
  2550. Default: ``False``
    
  2551. 
    
  2552. If ``True``, the :class:`~django.middleware.security.SecurityMiddleware`
    
  2553. :ref:`redirects <ssl-redirect>` all non-HTTPS requests to HTTPS (except for
    
  2554. those URLs matching a regular expression listed in
    
  2555. :setting:`SECURE_REDIRECT_EXEMPT`).
    
  2556. 
    
  2557. .. note::
    
  2558. 
    
  2559.    If turning this to ``True`` causes infinite redirects, it probably means
    
  2560.    your site is running behind a proxy and can't tell which requests are secure
    
  2561.    and which are not. Your proxy likely sets a header to indicate secure
    
  2562.    requests; you can correct the problem by finding out what that header is and
    
  2563.    configuring the :setting:`SECURE_PROXY_SSL_HEADER` setting accordingly.
    
  2564. 
    
  2565. .. setting:: SERIALIZATION_MODULES
    
  2566. 
    
  2567. ``SERIALIZATION_MODULES``
    
  2568. -------------------------
    
  2569. 
    
  2570. Default: Not defined
    
  2571. 
    
  2572. A dictionary of modules containing serializer definitions (provided as
    
  2573. strings), keyed by a string identifier for that serialization type. For
    
  2574. example, to define a YAML serializer, use::
    
  2575. 
    
  2576.     SERIALIZATION_MODULES = {'yaml': 'path.to.yaml_serializer'}
    
  2577. 
    
  2578. .. setting:: SERVER_EMAIL
    
  2579. 
    
  2580. ``SERVER_EMAIL``
    
  2581. ----------------
    
  2582. 
    
  2583. Default: ``'root@localhost'``
    
  2584. 
    
  2585. The email address that error messages come from, such as those sent to
    
  2586. :setting:`ADMINS` and :setting:`MANAGERS`.
    
  2587. 
    
  2588. .. admonition:: Why are my emails sent from a different address?
    
  2589. 
    
  2590.     This address is used only for error messages. It is *not* the address that
    
  2591.     regular email messages sent with :meth:`~django.core.mail.send_mail()`
    
  2592.     come from; for that, see :setting:`DEFAULT_FROM_EMAIL`.
    
  2593. 
    
  2594. .. setting:: SHORT_DATE_FORMAT
    
  2595. 
    
  2596. ``SHORT_DATE_FORMAT``
    
  2597. ---------------------
    
  2598. 
    
  2599. Default: ``'m/d/Y'`` (e.g. ``12/31/2003``)
    
  2600. 
    
  2601. An available formatting that can be used for displaying date fields on
    
  2602. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
    
  2603. corresponding locale-dictated format has higher precedence and will be applied.
    
  2604. See :tfilter:`allowed date format strings <date>`.
    
  2605. 
    
  2606. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATETIME_FORMAT`.
    
  2607. 
    
  2608. .. setting:: SHORT_DATETIME_FORMAT
    
  2609. 
    
  2610. ``SHORT_DATETIME_FORMAT``
    
  2611. -------------------------
    
  2612. 
    
  2613. Default: ``'m/d/Y P'`` (e.g. ``12/31/2003 4 p.m.``)
    
  2614. 
    
  2615. An available formatting that can be used for displaying datetime fields on
    
  2616. templates. Note that if :setting:`USE_L10N` is set to ``True``, then the
    
  2617. corresponding locale-dictated format has higher precedence and will be applied.
    
  2618. See :tfilter:`allowed date format strings <date>`.
    
  2619. 
    
  2620. See also :setting:`DATE_FORMAT` and :setting:`SHORT_DATE_FORMAT`.
    
  2621. 
    
  2622. .. setting:: SIGNING_BACKEND
    
  2623. 
    
  2624. ``SIGNING_BACKEND``
    
  2625. -------------------
    
  2626. 
    
  2627. Default: ``'django.core.signing.TimestampSigner'``
    
  2628. 
    
  2629. The backend used for signing cookies and other data.
    
  2630. 
    
  2631. See also the :doc:`/topics/signing` documentation.
    
  2632. 
    
  2633. .. setting:: SILENCED_SYSTEM_CHECKS
    
  2634. 
    
  2635. ``SILENCED_SYSTEM_CHECKS``
    
  2636. --------------------------
    
  2637. 
    
  2638. Default: ``[]`` (Empty list)
    
  2639. 
    
  2640. A list of identifiers of messages generated by the system check framework
    
  2641. (i.e. ``["models.W001"]``) that you wish to permanently acknowledge and ignore.
    
  2642. Silenced checks will not be output to the console.
    
  2643. 
    
  2644. See also the :doc:`/ref/checks` documentation.
    
  2645. 
    
  2646. .. setting:: TEMPLATES
    
  2647. 
    
  2648. ``TEMPLATES``
    
  2649. -------------
    
  2650. 
    
  2651. Default: ``[]`` (Empty list)
    
  2652. 
    
  2653. A list containing the settings for all template engines to be used with
    
  2654. Django. Each item of the list is a dictionary containing the options for an
    
  2655. individual engine.
    
  2656. 
    
  2657. Here's a setup that tells the Django template engine to load templates from the
    
  2658. ``templates`` subdirectory inside each installed application::
    
  2659. 
    
  2660.     TEMPLATES = [
    
  2661.         {
    
  2662.             'BACKEND': 'django.template.backends.django.DjangoTemplates',
    
  2663.             'APP_DIRS': True,
    
  2664.         },
    
  2665.     ]
    
  2666. 
    
  2667. The following options are available for all backends.
    
  2668. 
    
  2669. .. setting:: TEMPLATES-BACKEND
    
  2670. 
    
  2671. ``BACKEND``
    
  2672. ~~~~~~~~~~~
    
  2673. 
    
  2674. Default: Not defined
    
  2675. 
    
  2676. The template backend to use. The built-in template backends are:
    
  2677. 
    
  2678. * ``'django.template.backends.django.DjangoTemplates'``
    
  2679. * ``'django.template.backends.jinja2.Jinja2'``
    
  2680. 
    
  2681. You can use a template backend that doesn't ship with Django by setting
    
  2682. ``BACKEND`` to a fully-qualified path (i.e. ``'mypackage.whatever.Backend'``).
    
  2683. 
    
  2684. .. setting:: TEMPLATES-NAME
    
  2685. 
    
  2686. ``NAME``
    
  2687. ~~~~~~~~
    
  2688. 
    
  2689. Default: see below
    
  2690. 
    
  2691. The alias for this particular template engine. It's an identifier that allows
    
  2692. selecting an engine for rendering. Aliases must be unique across all
    
  2693. configured template engines.
    
  2694. 
    
  2695. It defaults to the name of the module defining the engine class, i.e. the
    
  2696. next to last piece of :setting:`BACKEND <TEMPLATES-BACKEND>`, when it isn't
    
  2697. provided. For example if the backend is ``'mypackage.whatever.Backend'`` then
    
  2698. its default name is ``'whatever'``.
    
  2699. 
    
  2700. .. setting:: TEMPLATES-DIRS
    
  2701. 
    
  2702. ``DIRS``
    
  2703. ~~~~~~~~
    
  2704. 
    
  2705. Default: ``[]`` (Empty list)
    
  2706. 
    
  2707. Directories where the engine should look for template source files, in search
    
  2708. order.
    
  2709. 
    
  2710. .. setting:: TEMPLATES-APP_DIRS
    
  2711. 
    
  2712. ``APP_DIRS``
    
  2713. ~~~~~~~~~~~~
    
  2714. 
    
  2715. Default: ``False``
    
  2716. 
    
  2717. Whether the engine should look for template source files inside installed
    
  2718. applications.
    
  2719. 
    
  2720. .. note::
    
  2721. 
    
  2722.     The default :file:`settings.py` file created by :djadmin:`django-admin
    
  2723.     startproject <startproject>` sets ``'APP_DIRS': True``.
    
  2724. 
    
  2725. .. setting:: TEMPLATES-OPTIONS
    
  2726. 
    
  2727. ``OPTIONS``
    
  2728. ~~~~~~~~~~~
    
  2729. 
    
  2730. Default: ``{}`` (Empty dict)
    
  2731. 
    
  2732. Extra parameters to pass to the template backend. Available parameters vary
    
  2733. depending on the template backend. See
    
  2734. :class:`~django.template.backends.django.DjangoTemplates` and
    
  2735. :class:`~django.template.backends.jinja2.Jinja2` for the options of the
    
  2736. built-in backends.
    
  2737. 
    
  2738. .. setting:: TEST_RUNNER
    
  2739. 
    
  2740. ``TEST_RUNNER``
    
  2741. ---------------
    
  2742. 
    
  2743. Default: ``'django.test.runner.DiscoverRunner'``
    
  2744. 
    
  2745. The name of the class to use for starting the test suite. See
    
  2746. :ref:`other-testing-frameworks`.
    
  2747. 
    
  2748. .. setting:: TEST_NON_SERIALIZED_APPS
    
  2749. 
    
  2750. ``TEST_NON_SERIALIZED_APPS``
    
  2751. ----------------------------
    
  2752. 
    
  2753. Default: ``[]`` (Empty list)
    
  2754. 
    
  2755. In order to restore the database state between tests for
    
  2756. ``TransactionTestCase``\s and database backends without transactions, Django
    
  2757. will :ref:`serialize the contents of all apps <test-case-serialized-rollback>`
    
  2758. when it starts the test run so it can then reload from that copy before running
    
  2759. tests that need it.
    
  2760. 
    
  2761. This slows down the startup time of the test runner; if you have apps that
    
  2762. you know don't need this feature, you can add their full names in here (e.g.
    
  2763. ``'django.contrib.contenttypes'``) to exclude them from this serialization
    
  2764. process.
    
  2765. 
    
  2766. .. setting:: THOUSAND_SEPARATOR
    
  2767. 
    
  2768. ``THOUSAND_SEPARATOR``
    
  2769. ----------------------
    
  2770. 
    
  2771. Default: ``','`` (Comma)
    
  2772. 
    
  2773. Default thousand separator used when formatting numbers. This setting is
    
  2774. used only when :setting:`USE_THOUSAND_SEPARATOR` is ``True`` and
    
  2775. :setting:`NUMBER_GROUPING` is greater than ``0``.
    
  2776. 
    
  2777. Note that if :setting:`USE_L10N` is set to ``True``, then the locale-dictated
    
  2778. format has higher precedence and will be applied instead.
    
  2779. 
    
  2780. See also :setting:`NUMBER_GROUPING`, :setting:`DECIMAL_SEPARATOR` and
    
  2781. :setting:`USE_THOUSAND_SEPARATOR`.
    
  2782. 
    
  2783. .. setting:: TIME_FORMAT
    
  2784. 
    
  2785. ``TIME_FORMAT``
    
  2786. ---------------
    
  2787. 
    
  2788. Default: ``'P'`` (e.g. ``4 p.m.``)
    
  2789. 
    
  2790. The default formatting to use for displaying time fields in any part of the
    
  2791. system. Note that if :setting:`USE_L10N` is set to ``True``, then the
    
  2792. locale-dictated format has higher precedence and will be applied instead. See
    
  2793. :tfilter:`allowed date format strings <date>`.
    
  2794. 
    
  2795. See also :setting:`DATE_FORMAT` and :setting:`DATETIME_FORMAT`.
    
  2796. 
    
  2797. .. setting:: TIME_INPUT_FORMATS
    
  2798. 
    
  2799. ``TIME_INPUT_FORMATS``
    
  2800. ----------------------
    
  2801. 
    
  2802. Default::
    
  2803. 
    
  2804.     [
    
  2805.         '%H:%M:%S',     # '14:30:59'
    
  2806.         '%H:%M:%S.%f',  # '14:30:59.000200'
    
  2807.         '%H:%M',        # '14:30'
    
  2808.     ]
    
  2809. 
    
  2810. A list of formats that will be accepted when inputting data on a time field.
    
  2811. Formats will be tried in order, using the first valid one. Note that these
    
  2812. format strings use Python's :ref:`datetime module syntax
    
  2813. <strftime-strptime-behavior>`, not the format strings from the :tfilter:`date`
    
  2814. template filter.
    
  2815. 
    
  2816. When :setting:`USE_L10N` is ``True``, the locale-dictated format has higher
    
  2817. precedence and will be applied instead.
    
  2818. 
    
  2819. See also :setting:`DATE_INPUT_FORMATS` and :setting:`DATETIME_INPUT_FORMATS`.
    
  2820. 
    
  2821. .. setting:: TIME_ZONE
    
  2822. 
    
  2823. ``TIME_ZONE``
    
  2824. -------------
    
  2825. 
    
  2826. Default: ``'America/Chicago'``
    
  2827. 
    
  2828. A string representing the time zone for this installation. See the `list of
    
  2829. time zones`_.
    
  2830. 
    
  2831. .. note::
    
  2832.     Since Django was first released with the :setting:`TIME_ZONE` set to
    
  2833.     ``'America/Chicago'``, the global setting (used if nothing is defined in
    
  2834.     your project's ``settings.py``) remains ``'America/Chicago'`` for backwards
    
  2835.     compatibility. New project templates default to ``'UTC'``.
    
  2836. 
    
  2837. Note that this isn't necessarily the time zone of the server. For example, one
    
  2838. server may serve multiple Django-powered sites, each with a separate time zone
    
  2839. setting.
    
  2840. 
    
  2841. When :setting:`USE_TZ` is ``False``, this is the time zone in which Django
    
  2842. will store all datetimes. When :setting:`USE_TZ` is ``True``, this is the
    
  2843. default time zone that Django will use to display datetimes in templates and
    
  2844. to interpret datetimes entered in forms.
    
  2845. 
    
  2846. On Unix environments (where :func:`time.tzset` is implemented), Django sets the
    
  2847. ``os.environ['TZ']`` variable to the time zone you specify in the
    
  2848. :setting:`TIME_ZONE` setting. Thus, all your views and models will
    
  2849. automatically operate in this time zone. However, Django won't set the ``TZ``
    
  2850. environment variable if you're using the manual configuration option as
    
  2851. described in :ref:`manually configuring settings
    
  2852. <settings-without-django-settings-module>`. If Django doesn't set the ``TZ``
    
  2853. environment variable, it's up to you to ensure your processes are running in
    
  2854. the correct environment.
    
  2855. 
    
  2856. .. note::
    
  2857.     Django cannot reliably use alternate time zones in a Windows environment.
    
  2858.     If you're running Django on Windows, :setting:`TIME_ZONE` must be set to
    
  2859.     match the system time zone.
    
  2860. 
    
  2861. .. _list of time zones: https://en.wikipedia.org/wiki/List_of_tz_database_time_zones
    
  2862. 
    
  2863. .. setting:: USE_DEPRECATED_PYTZ
    
  2864. 
    
  2865. ``USE_DEPRECATED_PYTZ``
    
  2866. -----------------------
    
  2867. 
    
  2868. .. versionadded:: 4.0
    
  2869. 
    
  2870. Default: ``False``
    
  2871. 
    
  2872. A boolean that specifies whether to use ``pytz``, rather than :mod:`zoneinfo`,
    
  2873. as the default time zone implementation.
    
  2874. 
    
  2875. .. deprecated:: 4.0
    
  2876. 
    
  2877.     This transitional setting is deprecated. Support for using ``pytz`` will be
    
  2878.     removed in Django 5.0.
    
  2879. 
    
  2880. .. setting:: USE_I18N
    
  2881. 
    
  2882. ``USE_I18N``
    
  2883. ------------
    
  2884. 
    
  2885. Default: ``True``
    
  2886. 
    
  2887. A boolean that specifies whether Django's translation system should be enabled.
    
  2888. This provides a way to turn it off, for performance. If this is set to
    
  2889. ``False``, Django will make some optimizations so as not to load the
    
  2890. translation machinery.
    
  2891. 
    
  2892. See also :setting:`LANGUAGE_CODE`, :setting:`USE_L10N` and :setting:`USE_TZ`.
    
  2893. 
    
  2894. .. note::
    
  2895. 
    
  2896.     The default :file:`settings.py` file created by :djadmin:`django-admin
    
  2897.     startproject <startproject>` includes ``USE_I18N = True`` for convenience.
    
  2898. 
    
  2899. .. setting:: USE_L10N
    
  2900. 
    
  2901. ``USE_L10N``
    
  2902. ------------
    
  2903. 
    
  2904. Default: ``True``
    
  2905. 
    
  2906. A boolean that specifies if localized formatting of data will be enabled by
    
  2907. default or not. If this is set to ``True``, e.g. Django will display numbers and
    
  2908. dates using the format of the current locale.
    
  2909. 
    
  2910. See also :setting:`LANGUAGE_CODE`, :setting:`USE_I18N` and :setting:`USE_TZ`.
    
  2911. 
    
  2912. .. versionchanged:: 4.0
    
  2913. 
    
  2914.     In older versions, the default value is ``False``.
    
  2915. 
    
  2916. .. deprecated:: 4.0
    
  2917. 
    
  2918.     This setting is deprecated. Starting with Django 5.0, localized formatting
    
  2919.     of data will always be enabled. For example Django will display numbers and
    
  2920.     dates using the format of the current locale.
    
  2921. 
    
  2922. .. setting:: USE_THOUSAND_SEPARATOR
    
  2923. 
    
  2924. ``USE_THOUSAND_SEPARATOR``
    
  2925. --------------------------
    
  2926. 
    
  2927. Default: ``False``
    
  2928. 
    
  2929. A boolean that specifies whether to display numbers using a thousand separator.
    
  2930. When set to ``True`` and :setting:`USE_L10N` is also ``True``, Django will
    
  2931. format numbers using the :setting:`NUMBER_GROUPING` and
    
  2932. :setting:`THOUSAND_SEPARATOR` settings. The latter two settings may also be
    
  2933. dictated by the locale, which takes precedence.
    
  2934. 
    
  2935. See also :setting:`DECIMAL_SEPARATOR`, :setting:`NUMBER_GROUPING` and
    
  2936. :setting:`THOUSAND_SEPARATOR`.
    
  2937. 
    
  2938. .. setting:: USE_TZ
    
  2939. 
    
  2940. ``USE_TZ``
    
  2941. ----------
    
  2942. 
    
  2943. Default: ``False``
    
  2944. 
    
  2945. .. note::
    
  2946. 
    
  2947.     In Django 5.0, the default value will change from ``False`` to ``True``.
    
  2948. 
    
  2949. A boolean that specifies if datetimes will be timezone-aware by default or not.
    
  2950. If this is set to ``True``, Django will use timezone-aware datetimes internally.
    
  2951. 
    
  2952. When ``USE_TZ`` is False, Django will use naive datetimes in local time, except
    
  2953. when parsing ISO 8601 formatted strings, where timezone information will always
    
  2954. be retained if present.
    
  2955. 
    
  2956. See also :setting:`TIME_ZONE`, :setting:`USE_I18N` and :setting:`USE_L10N`.
    
  2957. 
    
  2958. .. note::
    
  2959. 
    
  2960.     The default :file:`settings.py` file created by
    
  2961.     :djadmin:`django-admin startproject <startproject>` includes
    
  2962.     ``USE_TZ = True`` for convenience.
    
  2963. 
    
  2964. .. setting:: USE_X_FORWARDED_HOST
    
  2965. 
    
  2966. ``USE_X_FORWARDED_HOST``
    
  2967. ------------------------
    
  2968. 
    
  2969. Default: ``False``
    
  2970. 
    
  2971. A boolean that specifies whether to use the ``X-Forwarded-Host`` header in
    
  2972. preference to the ``Host`` header. This should only be enabled if a proxy
    
  2973. which sets this header is in use.
    
  2974. 
    
  2975. This setting takes priority over :setting:`USE_X_FORWARDED_PORT`. Per
    
  2976. :rfc:`7239#section-5.3`, the ``X-Forwarded-Host`` header can include the port
    
  2977. number, in which case you shouldn't use :setting:`USE_X_FORWARDED_PORT`.
    
  2978. 
    
  2979. .. setting:: USE_X_FORWARDED_PORT
    
  2980. 
    
  2981. ``USE_X_FORWARDED_PORT``
    
  2982. ------------------------
    
  2983. 
    
  2984. Default: ``False``
    
  2985. 
    
  2986. A boolean that specifies whether to use the ``X-Forwarded-Port`` header in
    
  2987. preference to the ``SERVER_PORT`` ``META`` variable. This should only be
    
  2988. enabled if a proxy which sets this header is in use.
    
  2989. 
    
  2990. :setting:`USE_X_FORWARDED_HOST` takes priority over this setting.
    
  2991. 
    
  2992. .. setting:: WSGI_APPLICATION
    
  2993. 
    
  2994. ``WSGI_APPLICATION``
    
  2995. --------------------
    
  2996. 
    
  2997. Default: ``None``
    
  2998. 
    
  2999. The full Python path of the WSGI application object that Django's built-in
    
  3000. servers (e.g. :djadmin:`runserver`) will use. The :djadmin:`django-admin
    
  3001. startproject <startproject>` management command will create a standard
    
  3002. ``wsgi.py`` file with an ``application`` callable in it, and point this setting
    
  3003. to that ``application``.
    
  3004. 
    
  3005. If not set, the return value of ``django.core.wsgi.get_wsgi_application()``
    
  3006. will be used. In this case, the behavior of :djadmin:`runserver` will be
    
  3007. identical to previous Django versions.
    
  3008. 
    
  3009. .. setting:: YEAR_MONTH_FORMAT
    
  3010. 
    
  3011. ``YEAR_MONTH_FORMAT``
    
  3012. ---------------------
    
  3013. 
    
  3014. Default: ``'F Y'``
    
  3015. 
    
  3016. The default formatting to use for date fields on Django admin change-list
    
  3017. pages -- and, possibly, by other parts of the system -- in cases when only the
    
  3018. year and month are displayed.
    
  3019. 
    
  3020. For example, when a Django admin change-list page is being filtered by a date
    
  3021. drilldown, the header for a given month displays the month and the year.
    
  3022. Different locales have different formats. For example, U.S. English would say
    
  3023. "January 2006," whereas another locale might say "2006/January."
    
  3024. 
    
  3025. Note that if :setting:`USE_L10N` is set to ``True``, then the corresponding
    
  3026. locale-dictated format has higher precedence and will be applied.
    
  3027. 
    
  3028. See :tfilter:`allowed date format strings <date>`. See also
    
  3029. :setting:`DATE_FORMAT`, :setting:`DATETIME_FORMAT`, :setting:`TIME_FORMAT`
    
  3030. and :setting:`MONTH_DAY_FORMAT`.
    
  3031. 
    
  3032. .. setting:: X_FRAME_OPTIONS
    
  3033. 
    
  3034. ``X_FRAME_OPTIONS``
    
  3035. -------------------
    
  3036. 
    
  3037. Default: ``'DENY'``
    
  3038. 
    
  3039. The default value for the X-Frame-Options header used by
    
  3040. :class:`~django.middleware.clickjacking.XFrameOptionsMiddleware`. See the
    
  3041. :doc:`clickjacking protection </ref/clickjacking/>` documentation.
    
  3042. 
    
  3043. Auth
    
  3044. ====
    
  3045. 
    
  3046. Settings for :mod:`django.contrib.auth`.
    
  3047. 
    
  3048. .. setting:: AUTHENTICATION_BACKENDS
    
  3049. 
    
  3050. ``AUTHENTICATION_BACKENDS``
    
  3051. ---------------------------
    
  3052. 
    
  3053. Default: ``['django.contrib.auth.backends.ModelBackend']``
    
  3054. 
    
  3055. A list of authentication backend classes (as strings) to use when attempting to
    
  3056. authenticate a user. See the :ref:`authentication backends documentation
    
  3057. <authentication-backends>` for details.
    
  3058. 
    
  3059. .. setting:: AUTH_USER_MODEL
    
  3060. 
    
  3061. ``AUTH_USER_MODEL``
    
  3062. -------------------
    
  3063. 
    
  3064. Default: ``'auth.User'``
    
  3065. 
    
  3066. The model to use to represent a User. See :ref:`auth-custom-user`.
    
  3067. 
    
  3068. .. warning::
    
  3069.     You cannot change the AUTH_USER_MODEL setting during the lifetime of
    
  3070.     a project (i.e. once you have made and migrated models that depend on it)
    
  3071.     without serious effort. It is intended to be set at the project start,
    
  3072.     and the model it refers to must be available in the first migration of
    
  3073.     the app that it lives in.
    
  3074.     See :ref:`auth-custom-user` for more details.
    
  3075. 
    
  3076. .. setting:: LOGIN_REDIRECT_URL
    
  3077. 
    
  3078. ``LOGIN_REDIRECT_URL``
    
  3079. ----------------------
    
  3080. 
    
  3081. Default: ``'/accounts/profile/'``
    
  3082. 
    
  3083. The URL or :ref:`named URL pattern <naming-url-patterns>` where requests are
    
  3084. redirected after login when the :class:`~django.contrib.auth.views.LoginView`
    
  3085. doesn't get a ``next`` GET parameter.
    
  3086. 
    
  3087. .. setting:: LOGIN_URL
    
  3088. 
    
  3089. ``LOGIN_URL``
    
  3090. -------------
    
  3091. 
    
  3092. Default: ``'/accounts/login/'``
    
  3093. 
    
  3094. The URL or :ref:`named URL pattern <naming-url-patterns>` where requests are
    
  3095. redirected for login when using the
    
  3096. :func:`~django.contrib.auth.decorators.login_required` decorator,
    
  3097. :class:`~django.contrib.auth.mixins.LoginRequiredMixin`, or
    
  3098. :class:`~django.contrib.auth.mixins.AccessMixin`.
    
  3099. 
    
  3100. .. setting:: LOGOUT_REDIRECT_URL
    
  3101. 
    
  3102. ``LOGOUT_REDIRECT_URL``
    
  3103. -----------------------
    
  3104. 
    
  3105. Default: ``None``
    
  3106. 
    
  3107. The URL or :ref:`named URL pattern <naming-url-patterns>` where requests are
    
  3108. redirected after logout if :class:`~django.contrib.auth.views.LogoutView`
    
  3109. doesn't have a ``next_page`` attribute.
    
  3110. 
    
  3111. If ``None``, no redirect will be performed and the logout view will be
    
  3112. rendered.
    
  3113. 
    
  3114. .. setting:: PASSWORD_RESET_TIMEOUT
    
  3115. 
    
  3116. ``PASSWORD_RESET_TIMEOUT``
    
  3117. --------------------------
    
  3118. 
    
  3119. Default: ``259200`` (3 days, in seconds)
    
  3120. 
    
  3121. The number of seconds a password reset link is valid for.
    
  3122. 
    
  3123. Used by the :class:`~django.contrib.auth.views.PasswordResetConfirmView`.
    
  3124. 
    
  3125. .. note::
    
  3126. 
    
  3127.    Reducing the value of this timeout doesn't make any difference to the
    
  3128.    ability of an attacker to brute-force a password reset token. Tokens are
    
  3129.    designed to be safe from brute-forcing without any timeout.
    
  3130. 
    
  3131.    This timeout exists to protect against some unlikely attack scenarios, such
    
  3132.    as someone gaining access to email archives that may contain old, unused
    
  3133.    password reset tokens.
    
  3134. 
    
  3135. .. setting:: PASSWORD_HASHERS
    
  3136. 
    
  3137. ``PASSWORD_HASHERS``
    
  3138. --------------------
    
  3139. 
    
  3140. See :ref:`auth_password_storage`.
    
  3141. 
    
  3142. Default::
    
  3143. 
    
  3144.     [
    
  3145.         'django.contrib.auth.hashers.PBKDF2PasswordHasher',
    
  3146.         'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher',
    
  3147.         'django.contrib.auth.hashers.Argon2PasswordHasher',
    
  3148.         'django.contrib.auth.hashers.BCryptSHA256PasswordHasher',
    
  3149.     ]
    
  3150. 
    
  3151. .. setting:: AUTH_PASSWORD_VALIDATORS
    
  3152. 
    
  3153. ``AUTH_PASSWORD_VALIDATORS``
    
  3154. ----------------------------
    
  3155. 
    
  3156. Default: ``[]`` (Empty list)
    
  3157. 
    
  3158. The list of validators that are used to check the strength of user's passwords.
    
  3159. See :ref:`password-validation` for more details. By default, no validation is
    
  3160. performed and all passwords are accepted.
    
  3161. 
    
  3162. .. _settings-messages:
    
  3163. 
    
  3164. Messages
    
  3165. ========
    
  3166. 
    
  3167. Settings for :mod:`django.contrib.messages`.
    
  3168. 
    
  3169. .. setting:: MESSAGE_LEVEL
    
  3170. 
    
  3171. ``MESSAGE_LEVEL``
    
  3172. -----------------
    
  3173. 
    
  3174. Default: ``messages.INFO``
    
  3175. 
    
  3176. Sets the minimum message level that will be recorded by the messages
    
  3177. framework. See :ref:`message levels <message-level>` for more details.
    
  3178. 
    
  3179. .. admonition:: Important
    
  3180. 
    
  3181.    If you override ``MESSAGE_LEVEL`` in your settings file and rely on any of
    
  3182.    the built-in constants, you must import the constants module directly to
    
  3183.    avoid the potential for circular imports, e.g.::
    
  3184. 
    
  3185.        from django.contrib.messages import constants as message_constants
    
  3186.        MESSAGE_LEVEL = message_constants.DEBUG
    
  3187. 
    
  3188.    If desired, you may specify the numeric values for the constants directly
    
  3189.    according to the values in the above :ref:`constants table
    
  3190.    <message-level-constants>`.
    
  3191. 
    
  3192. .. setting:: MESSAGE_STORAGE
    
  3193. 
    
  3194. ``MESSAGE_STORAGE``
    
  3195. -------------------
    
  3196. 
    
  3197. Default: ``'django.contrib.messages.storage.fallback.FallbackStorage'``
    
  3198. 
    
  3199. Controls where Django stores message data. Valid values are:
    
  3200. 
    
  3201. * ``'django.contrib.messages.storage.fallback.FallbackStorage'``
    
  3202. * ``'django.contrib.messages.storage.session.SessionStorage'``
    
  3203. * ``'django.contrib.messages.storage.cookie.CookieStorage'``
    
  3204. 
    
  3205. See :ref:`message storage backends <message-storage-backends>` for more details.
    
  3206. 
    
  3207. The backends that use cookies --
    
  3208. :class:`~django.contrib.messages.storage.cookie.CookieStorage` and
    
  3209. :class:`~django.contrib.messages.storage.fallback.FallbackStorage` --
    
  3210. use the value of :setting:`SESSION_COOKIE_DOMAIN`, :setting:`SESSION_COOKIE_SECURE`
    
  3211. and :setting:`SESSION_COOKIE_HTTPONLY` when setting their cookies.
    
  3212. 
    
  3213. .. setting:: MESSAGE_TAGS
    
  3214. 
    
  3215. ``MESSAGE_TAGS``
    
  3216. ----------------
    
  3217. 
    
  3218. Default::
    
  3219. 
    
  3220.     {
    
  3221.         messages.DEBUG: 'debug',
    
  3222.         messages.INFO: 'info',
    
  3223.         messages.SUCCESS: 'success',
    
  3224.         messages.WARNING: 'warning',
    
  3225.         messages.ERROR: 'error',
    
  3226.     }
    
  3227. 
    
  3228. This sets the mapping of message level to message tag, which is typically
    
  3229. rendered as a CSS class in HTML. If you specify a value, it will extend
    
  3230. the default. This means you only have to specify those values which you need
    
  3231. to override. See :ref:`message-displaying` above for more details.
    
  3232. 
    
  3233. .. admonition:: Important
    
  3234. 
    
  3235.    If you override ``MESSAGE_TAGS`` in your settings file and rely on any of
    
  3236.    the built-in constants, you must import the ``constants`` module directly to
    
  3237.    avoid the potential for circular imports, e.g.::
    
  3238. 
    
  3239.        from django.contrib.messages import constants as message_constants
    
  3240.        MESSAGE_TAGS = {message_constants.INFO: ''}
    
  3241. 
    
  3242.    If desired, you may specify the numeric values for the constants directly
    
  3243.    according to the values in the above :ref:`constants table
    
  3244.    <message-level-constants>`.
    
  3245. 
    
  3246. .. _settings-sessions:
    
  3247. 
    
  3248. Sessions
    
  3249. ========
    
  3250. 
    
  3251. Settings for :mod:`django.contrib.sessions`.
    
  3252. 
    
  3253. .. setting:: SESSION_CACHE_ALIAS
    
  3254. 
    
  3255. ``SESSION_CACHE_ALIAS``
    
  3256. -----------------------
    
  3257. 
    
  3258. Default: ``'default'``
    
  3259. 
    
  3260. If you're using :ref:`cache-based session storage <cached-sessions-backend>`,
    
  3261. this selects the cache to use.
    
  3262. 
    
  3263. .. setting:: SESSION_COOKIE_AGE
    
  3264. 
    
  3265. ``SESSION_COOKIE_AGE``
    
  3266. ----------------------
    
  3267. 
    
  3268. Default: ``1209600`` (2 weeks, in seconds)
    
  3269. 
    
  3270. The age of session cookies, in seconds.
    
  3271. 
    
  3272. .. setting:: SESSION_COOKIE_DOMAIN
    
  3273. 
    
  3274. ``SESSION_COOKIE_DOMAIN``
    
  3275. -------------------------
    
  3276. 
    
  3277. Default: ``None``
    
  3278. 
    
  3279. The domain to use for session cookies. Set this to a string such as
    
  3280. ``"example.com"`` for cross-domain cookies, or use ``None`` for a standard
    
  3281. domain cookie.
    
  3282. 
    
  3283. To use cross-domain cookies with :setting:`CSRF_USE_SESSIONS`, you must include
    
  3284. a leading dot (e.g. ``".example.com"``) to accommodate the CSRF middleware's
    
  3285. referer checking.
    
  3286. 
    
  3287. Be cautious when updating this setting on a production site. If you update
    
  3288. this setting to enable cross-domain cookies on a site that previously used
    
  3289. standard domain cookies, existing user cookies will be set to the old
    
  3290. domain. This may result in them being unable to log in as long as these cookies
    
  3291. persist.
    
  3292. 
    
  3293. This setting also affects cookies set by :mod:`django.contrib.messages`.
    
  3294. 
    
  3295. .. setting:: SESSION_COOKIE_HTTPONLY
    
  3296. 
    
  3297. ``SESSION_COOKIE_HTTPONLY``
    
  3298. ---------------------------
    
  3299. 
    
  3300. Default: ``True``
    
  3301. 
    
  3302. Whether to use ``HttpOnly`` flag on the session cookie. If this is set to
    
  3303. ``True``, client-side JavaScript will not be able to access the session
    
  3304. cookie.
    
  3305. 
    
  3306. HttpOnly_ is a flag included in a Set-Cookie HTTP response header. It's part of
    
  3307. the :rfc:`6265#section-4.1.2.6` standard for cookies and can be a useful way to
    
  3308. mitigate the risk of a client-side script accessing the protected cookie data.
    
  3309. 
    
  3310. This makes it less trivial for an attacker to escalate a cross-site scripting
    
  3311. vulnerability into full hijacking of a user's session. There aren't many good
    
  3312. reasons for turning this off. Your code shouldn't read session cookies from
    
  3313. JavaScript.
    
  3314. 
    
  3315. .. _HttpOnly: https://owasp.org/www-community/HttpOnly
    
  3316. 
    
  3317. .. setting:: SESSION_COOKIE_NAME
    
  3318. 
    
  3319. ``SESSION_COOKIE_NAME``
    
  3320. -----------------------
    
  3321. 
    
  3322. Default: ``'sessionid'``
    
  3323. 
    
  3324. The name of the cookie to use for sessions. This can be whatever you want
    
  3325. (as long as it's different from the other cookie names in your application).
    
  3326. 
    
  3327. .. setting:: SESSION_COOKIE_PATH
    
  3328. 
    
  3329. ``SESSION_COOKIE_PATH``
    
  3330. -----------------------
    
  3331. 
    
  3332. Default: ``'/'``
    
  3333. 
    
  3334. The path set on the session cookie. This should either match the URL path of your
    
  3335. Django installation or be parent of that path.
    
  3336. 
    
  3337. This is useful if you have multiple Django instances running under the same
    
  3338. hostname. They can use different cookie paths, and each instance will only see
    
  3339. its own session cookie.
    
  3340. 
    
  3341. .. setting:: SESSION_COOKIE_SAMESITE
    
  3342. 
    
  3343. ``SESSION_COOKIE_SAMESITE``
    
  3344. ---------------------------
    
  3345. 
    
  3346. Default: ``'Lax'``
    
  3347. 
    
  3348. The value of the `SameSite`_ flag on the session cookie. This flag prevents the
    
  3349. cookie from being sent in cross-site requests thus preventing CSRF attacks and
    
  3350. making some methods of stealing session cookie impossible.
    
  3351. 
    
  3352. Possible values for the setting are:
    
  3353. 
    
  3354. * ``'Strict'``: prevents the cookie from being sent by the browser to the
    
  3355.   target site in all cross-site browsing context, even when following a regular
    
  3356.   link.
    
  3357. 
    
  3358.   For example, for a GitHub-like website this would mean that if a logged-in
    
  3359.   user follows a link to a private GitHub project posted on a corporate
    
  3360.   discussion forum or email, GitHub will not receive the session cookie and the
    
  3361.   user won't be able to access the project. A bank website, however, most
    
  3362.   likely doesn't want to allow any transactional pages to be linked from
    
  3363.   external sites so the ``'Strict'`` flag would be appropriate.
    
  3364. 
    
  3365. * ``'Lax'`` (default): provides a balance between security and usability for
    
  3366.   websites that want to maintain user's logged-in session after the user
    
  3367.   arrives from an external link.
    
  3368. 
    
  3369.   In the GitHub scenario, the session cookie would be allowed when following a
    
  3370.   regular link from an external website and be blocked in CSRF-prone request
    
  3371.   methods (e.g. ``POST``).
    
  3372. 
    
  3373. * ``'None'`` (string): the session cookie will be sent with all same-site and
    
  3374.   cross-site requests.
    
  3375. 
    
  3376. * ``False``: disables the flag.
    
  3377. 
    
  3378. .. note::
    
  3379. 
    
  3380.     Modern browsers provide a more secure default policy for the ``SameSite``
    
  3381.     flag and will assume ``Lax`` for cookies without an explicit value set.
    
  3382. 
    
  3383. .. _SameSite: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite
    
  3384. 
    
  3385. .. setting:: SESSION_COOKIE_SECURE
    
  3386. 
    
  3387. ``SESSION_COOKIE_SECURE``
    
  3388. -------------------------
    
  3389. 
    
  3390. Default: ``False``
    
  3391. 
    
  3392. Whether to use a secure cookie for the session cookie. If this is set to
    
  3393. ``True``, the cookie will be marked as "secure", which means browsers may
    
  3394. ensure that the cookie is only sent under an HTTPS connection.
    
  3395. 
    
  3396. Leaving this setting off isn't a good idea because an attacker could capture an
    
  3397. unencrypted session cookie with a packet sniffer and use the cookie to hijack
    
  3398. the user's session.
    
  3399. 
    
  3400. .. setting:: SESSION_ENGINE
    
  3401. 
    
  3402. ``SESSION_ENGINE``
    
  3403. ------------------
    
  3404. 
    
  3405. Default: ``'django.contrib.sessions.backends.db'``
    
  3406. 
    
  3407. Controls where Django stores session data. Included engines are:
    
  3408. 
    
  3409. * ``'django.contrib.sessions.backends.db'``
    
  3410. * ``'django.contrib.sessions.backends.file'``
    
  3411. * ``'django.contrib.sessions.backends.cache'``
    
  3412. * ``'django.contrib.sessions.backends.cached_db'``
    
  3413. * ``'django.contrib.sessions.backends.signed_cookies'``
    
  3414. 
    
  3415. See :ref:`configuring-sessions` for more details.
    
  3416. 
    
  3417. .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE
    
  3418. 
    
  3419. ``SESSION_EXPIRE_AT_BROWSER_CLOSE``
    
  3420. -----------------------------------
    
  3421. 
    
  3422. Default: ``False``
    
  3423. 
    
  3424. Whether to expire the session when the user closes their browser. See
    
  3425. :ref:`browser-length-vs-persistent-sessions`.
    
  3426. 
    
  3427. .. setting:: SESSION_FILE_PATH
    
  3428. 
    
  3429. ``SESSION_FILE_PATH``
    
  3430. ---------------------
    
  3431. 
    
  3432. Default: ``None``
    
  3433. 
    
  3434. If you're using file-based session storage, this sets the directory in
    
  3435. which Django will store session data. When the default value (``None``) is
    
  3436. used, Django will use the standard temporary directory for the system.
    
  3437. 
    
  3438. 
    
  3439. .. setting:: SESSION_SAVE_EVERY_REQUEST
    
  3440. 
    
  3441. ``SESSION_SAVE_EVERY_REQUEST``
    
  3442. ------------------------------
    
  3443. 
    
  3444. Default: ``False``
    
  3445. 
    
  3446. Whether to save the session data on every request. If this is ``False``
    
  3447. (default), then the session data will only be saved if it has been modified --
    
  3448. that is, if any of its dictionary values have been assigned or deleted. Empty
    
  3449. sessions won't be created, even if this setting is active.
    
  3450. 
    
  3451. .. setting:: SESSION_SERIALIZER
    
  3452. 
    
  3453. ``SESSION_SERIALIZER``
    
  3454. ----------------------
    
  3455. 
    
  3456. Default: ``'django.contrib.sessions.serializers.JSONSerializer'``
    
  3457. 
    
  3458. Full import path of a serializer class to use for serializing session data.
    
  3459. Included serializer is:
    
  3460. 
    
  3461. * ``'django.contrib.sessions.serializers.JSONSerializer'``
    
  3462. 
    
  3463. See :ref:`session_serialization` for details.
    
  3464. 
    
  3465. Sites
    
  3466. =====
    
  3467. 
    
  3468. Settings for :mod:`django.contrib.sites`.
    
  3469. 
    
  3470. .. setting:: SITE_ID
    
  3471. 
    
  3472. ``SITE_ID``
    
  3473. -----------
    
  3474. 
    
  3475. Default: Not defined
    
  3476. 
    
  3477. The ID, as an integer, of the current site in the ``django_site`` database
    
  3478. table. This is used so that application data can hook into specific sites
    
  3479. and a single database can manage content for multiple sites.
    
  3480. 
    
  3481. 
    
  3482. .. _settings-staticfiles:
    
  3483. 
    
  3484. Static Files
    
  3485. ============
    
  3486. 
    
  3487. Settings for :mod:`django.contrib.staticfiles`.
    
  3488. 
    
  3489. .. setting:: STATIC_ROOT
    
  3490. 
    
  3491. ``STATIC_ROOT``
    
  3492. ---------------
    
  3493. 
    
  3494. Default: ``None``
    
  3495. 
    
  3496. The absolute path to the directory where :djadmin:`collectstatic` will collect
    
  3497. static files for deployment.
    
  3498. 
    
  3499. Example: ``"/var/www/example.com/static/"``
    
  3500. 
    
  3501. If the :doc:`staticfiles</ref/contrib/staticfiles>` contrib app is enabled
    
  3502. (as in the default project template), the :djadmin:`collectstatic` management
    
  3503. command will collect static files into this directory. See the how-to on
    
  3504. :doc:`managing static files</howto/static-files/index>` for more details about
    
  3505. usage.
    
  3506. 
    
  3507. .. warning::
    
  3508. 
    
  3509.     This should be an initially empty destination directory for collecting
    
  3510.     your static files from their permanent locations into one directory for
    
  3511.     ease of deployment; it is **not** a place to store your static files
    
  3512.     permanently. You should do that in directories that will be found by
    
  3513.     :doc:`staticfiles</ref/contrib/staticfiles>`’s
    
  3514.     :setting:`finders<STATICFILES_FINDERS>`, which by default, are
    
  3515.     ``'static/'`` app sub-directories and any directories you include in
    
  3516.     :setting:`STATICFILES_DIRS`).
    
  3517. 
    
  3518. .. setting:: STATIC_URL
    
  3519. 
    
  3520. ``STATIC_URL``
    
  3521. --------------
    
  3522. 
    
  3523. Default: ``None``
    
  3524. 
    
  3525. URL to use when referring to static files located in :setting:`STATIC_ROOT`.
    
  3526. 
    
  3527. Example: ``"static/"`` or ``"http://static.example.com/"``
    
  3528. 
    
  3529. If not ``None``, this will be used as the base path for
    
  3530. :ref:`asset definitions<form-asset-paths>` (the ``Media`` class) and the
    
  3531. :doc:`staticfiles app</ref/contrib/staticfiles>`.
    
  3532. 
    
  3533. It must end in a slash if set to a non-empty value.
    
  3534. 
    
  3535. You may need to :ref:`configure these files to be served in development
    
  3536. <serving-static-files-in-development>` and will definitely need to do so
    
  3537. :doc:`in production </howto/static-files/deployment>`.
    
  3538. 
    
  3539. .. note::
    
  3540. 
    
  3541.     If :setting:`STATIC_URL` is a relative path, then it will be prefixed by
    
  3542.     the server-provided value of ``SCRIPT_NAME`` (or ``/`` if not set). This
    
  3543.     makes it easier to serve a Django application in a subpath without adding
    
  3544.     an extra configuration to the settings.
    
  3545. 
    
  3546. .. setting:: STATICFILES_DIRS
    
  3547. 
    
  3548. ``STATICFILES_DIRS``
    
  3549. --------------------
    
  3550. 
    
  3551. Default: ``[]`` (Empty list)
    
  3552. 
    
  3553. This setting defines the additional locations the staticfiles app will traverse
    
  3554. if the ``FileSystemFinder`` finder is enabled, e.g. if you use the
    
  3555. :djadmin:`collectstatic` or :djadmin:`findstatic` management command or use the
    
  3556. static file serving view.
    
  3557. 
    
  3558. This should be set to a list of strings that contain full paths to
    
  3559. your additional files directory(ies) e.g.::
    
  3560. 
    
  3561.     STATICFILES_DIRS = [
    
  3562.         "/home/special.polls.com/polls/static",
    
  3563.         "/home/polls.com/polls/static",
    
  3564.         "/opt/webfiles/common",
    
  3565.     ]
    
  3566. 
    
  3567. Note that these paths should use Unix-style forward slashes, even on Windows
    
  3568. (e.g. ``"C:/Users/user/mysite/extra_static_content"``).
    
  3569. 
    
  3570. .. _staticfiles-dirs-prefixes:
    
  3571. 
    
  3572. Prefixes (optional)
    
  3573. ~~~~~~~~~~~~~~~~~~~
    
  3574. 
    
  3575. In case you want to refer to files in one of the locations with an additional
    
  3576. namespace, you can **optionally** provide a prefix as ``(prefix, path)``
    
  3577. tuples, e.g.::
    
  3578. 
    
  3579.     STATICFILES_DIRS = [
    
  3580.         # ...
    
  3581.         ("downloads", "/opt/webfiles/stats"),
    
  3582.     ]
    
  3583. 
    
  3584. For example, assuming you have :setting:`STATIC_URL` set to ``'static/'``, the
    
  3585. :djadmin:`collectstatic` management command would collect the "stats" files
    
  3586. in a ``'downloads'`` subdirectory of :setting:`STATIC_ROOT`.
    
  3587. 
    
  3588. This would allow you to refer to the local file
    
  3589. ``'/opt/webfiles/stats/polls_20101022.tar.gz'`` with
    
  3590. ``'/static/downloads/polls_20101022.tar.gz'`` in your templates, e.g.:
    
  3591. 
    
  3592. .. code-block:: html+django
    
  3593. 
    
  3594.     <a href="{% static 'downloads/polls_20101022.tar.gz' %}">
    
  3595. 
    
  3596. .. setting:: STATICFILES_STORAGE
    
  3597. 
    
  3598. ``STATICFILES_STORAGE``
    
  3599. -----------------------
    
  3600. 
    
  3601. Default: ``'django.contrib.staticfiles.storage.StaticFilesStorage'``
    
  3602. 
    
  3603. The file storage engine to use when collecting static files with the
    
  3604. :djadmin:`collectstatic` management command.
    
  3605. 
    
  3606. A ready-to-use instance of the storage backend defined in this setting
    
  3607. can be found at ``django.contrib.staticfiles.storage.staticfiles_storage``.
    
  3608. 
    
  3609. For an example, see :ref:`staticfiles-from-cdn`.
    
  3610. 
    
  3611. .. setting:: STATICFILES_FINDERS
    
  3612. 
    
  3613. ``STATICFILES_FINDERS``
    
  3614. -----------------------
    
  3615. 
    
  3616. Default::
    
  3617. 
    
  3618.     [
    
  3619.         'django.contrib.staticfiles.finders.FileSystemFinder',
    
  3620.         'django.contrib.staticfiles.finders.AppDirectoriesFinder',
    
  3621.     ]
    
  3622. 
    
  3623. The list of finder backends that know how to find static files in
    
  3624. various locations.
    
  3625. 
    
  3626. The default will find files stored in the :setting:`STATICFILES_DIRS` setting
    
  3627. (using ``django.contrib.staticfiles.finders.FileSystemFinder``) and in a
    
  3628. ``static`` subdirectory of each app (using
    
  3629. ``django.contrib.staticfiles.finders.AppDirectoriesFinder``). If multiple
    
  3630. files with the same name are present, the first file that is found will be
    
  3631. used.
    
  3632. 
    
  3633. One finder is disabled by default:
    
  3634. ``django.contrib.staticfiles.finders.DefaultStorageFinder``. If added to
    
  3635. your :setting:`STATICFILES_FINDERS` setting, it will look for static files in
    
  3636. the default file storage as defined by the :setting:`DEFAULT_FILE_STORAGE`
    
  3637. setting.
    
  3638. 
    
  3639. .. note::
    
  3640. 
    
  3641.     When using the ``AppDirectoriesFinder`` finder, make sure your apps
    
  3642.     can be found by staticfiles by adding the app to the
    
  3643.     :setting:`INSTALLED_APPS` setting of your site.
    
  3644. 
    
  3645. Static file finders are currently considered a private interface, and this
    
  3646. interface is thus undocumented.
    
  3647. 
    
  3648. Core Settings Topical Index
    
  3649. ===========================
    
  3650. 
    
  3651. Cache
    
  3652. -----
    
  3653. * :setting:`CACHES`
    
  3654. * :setting:`CACHE_MIDDLEWARE_ALIAS`
    
  3655. * :setting:`CACHE_MIDDLEWARE_KEY_PREFIX`
    
  3656. * :setting:`CACHE_MIDDLEWARE_SECONDS`
    
  3657. 
    
  3658. Database
    
  3659. --------
    
  3660. * :setting:`DATABASES`
    
  3661. * :setting:`DATABASE_ROUTERS`
    
  3662. * :setting:`DEFAULT_INDEX_TABLESPACE`
    
  3663. * :setting:`DEFAULT_TABLESPACE`
    
  3664. 
    
  3665. Debugging
    
  3666. ---------
    
  3667. * :setting:`DEBUG`
    
  3668. * :setting:`DEBUG_PROPAGATE_EXCEPTIONS`
    
  3669. 
    
  3670. Email
    
  3671. -----
    
  3672. * :setting:`ADMINS`
    
  3673. * :setting:`DEFAULT_CHARSET`
    
  3674. * :setting:`DEFAULT_FROM_EMAIL`
    
  3675. * :setting:`EMAIL_BACKEND`
    
  3676. * :setting:`EMAIL_FILE_PATH`
    
  3677. * :setting:`EMAIL_HOST`
    
  3678. * :setting:`EMAIL_HOST_PASSWORD`
    
  3679. * :setting:`EMAIL_HOST_USER`
    
  3680. * :setting:`EMAIL_PORT`
    
  3681. * :setting:`EMAIL_SSL_CERTFILE`
    
  3682. * :setting:`EMAIL_SSL_KEYFILE`
    
  3683. * :setting:`EMAIL_SUBJECT_PREFIX`
    
  3684. * :setting:`EMAIL_TIMEOUT`
    
  3685. * :setting:`EMAIL_USE_LOCALTIME`
    
  3686. * :setting:`EMAIL_USE_TLS`
    
  3687. * :setting:`MANAGERS`
    
  3688. * :setting:`SERVER_EMAIL`
    
  3689. 
    
  3690. Error reporting
    
  3691. ---------------
    
  3692. * :setting:`DEFAULT_EXCEPTION_REPORTER`
    
  3693. * :setting:`DEFAULT_EXCEPTION_REPORTER_FILTER`
    
  3694. * :setting:`IGNORABLE_404_URLS`
    
  3695. * :setting:`MANAGERS`
    
  3696. * :setting:`SILENCED_SYSTEM_CHECKS`
    
  3697. 
    
  3698. .. _file-upload-settings:
    
  3699. 
    
  3700. File uploads
    
  3701. ------------
    
  3702. * :setting:`DEFAULT_FILE_STORAGE`
    
  3703. * :setting:`FILE_UPLOAD_HANDLERS`
    
  3704. * :setting:`FILE_UPLOAD_MAX_MEMORY_SIZE`
    
  3705. * :setting:`FILE_UPLOAD_PERMISSIONS`
    
  3706. * :setting:`FILE_UPLOAD_TEMP_DIR`
    
  3707. * :setting:`MEDIA_ROOT`
    
  3708. * :setting:`MEDIA_URL`
    
  3709. 
    
  3710. Forms
    
  3711. -----
    
  3712. * :setting:`FORM_RENDERER`
    
  3713. 
    
  3714. Globalization (``i18n``/``l10n``)
    
  3715. ---------------------------------
    
  3716. * :setting:`DATE_FORMAT`
    
  3717. * :setting:`DATE_INPUT_FORMATS`
    
  3718. * :setting:`DATETIME_FORMAT`
    
  3719. * :setting:`DATETIME_INPUT_FORMATS`
    
  3720. * :setting:`DECIMAL_SEPARATOR`
    
  3721. * :setting:`FIRST_DAY_OF_WEEK`
    
  3722. * :setting:`FORMAT_MODULE_PATH`
    
  3723. * :setting:`LANGUAGE_CODE`
    
  3724. * :setting:`LANGUAGE_COOKIE_AGE`
    
  3725. * :setting:`LANGUAGE_COOKIE_DOMAIN`
    
  3726. * :setting:`LANGUAGE_COOKIE_HTTPONLY`
    
  3727. * :setting:`LANGUAGE_COOKIE_NAME`
    
  3728. * :setting:`LANGUAGE_COOKIE_PATH`
    
  3729. * :setting:`LANGUAGE_COOKIE_SAMESITE`
    
  3730. * :setting:`LANGUAGE_COOKIE_SECURE`
    
  3731. * :setting:`LANGUAGES`
    
  3732. * :setting:`LANGUAGES_BIDI`
    
  3733. * :setting:`LOCALE_PATHS`
    
  3734. * :setting:`MONTH_DAY_FORMAT`
    
  3735. * :setting:`NUMBER_GROUPING`
    
  3736. * :setting:`SHORT_DATE_FORMAT`
    
  3737. * :setting:`SHORT_DATETIME_FORMAT`
    
  3738. * :setting:`THOUSAND_SEPARATOR`
    
  3739. * :setting:`TIME_FORMAT`
    
  3740. * :setting:`TIME_INPUT_FORMATS`
    
  3741. * :setting:`TIME_ZONE`
    
  3742. * :setting:`USE_I18N`
    
  3743. * :setting:`USE_L10N`
    
  3744. * :setting:`USE_THOUSAND_SEPARATOR`
    
  3745. * :setting:`USE_TZ`
    
  3746. * :setting:`YEAR_MONTH_FORMAT`
    
  3747. 
    
  3748. HTTP
    
  3749. ----
    
  3750. * :setting:`DATA_UPLOAD_MAX_MEMORY_SIZE`
    
  3751. * :setting:`DATA_UPLOAD_MAX_NUMBER_FIELDS`
    
  3752. * :setting:`DATA_UPLOAD_MAX_NUMBER_FILES`
    
  3753. * :setting:`DEFAULT_CHARSET`
    
  3754. * :setting:`DISALLOWED_USER_AGENTS`
    
  3755. * :setting:`FORCE_SCRIPT_NAME`
    
  3756. * :setting:`INTERNAL_IPS`
    
  3757. * :setting:`MIDDLEWARE`
    
  3758. * Security
    
  3759. 
    
  3760.   * :setting:`SECURE_CONTENT_TYPE_NOSNIFF`
    
  3761.   * :setting:`SECURE_CROSS_ORIGIN_OPENER_POLICY`
    
  3762.   * :setting:`SECURE_HSTS_INCLUDE_SUBDOMAINS`
    
  3763.   * :setting:`SECURE_HSTS_PRELOAD`
    
  3764.   * :setting:`SECURE_HSTS_SECONDS`
    
  3765.   * :setting:`SECURE_PROXY_SSL_HEADER`
    
  3766.   * :setting:`SECURE_REDIRECT_EXEMPT`
    
  3767.   * :setting:`SECURE_REFERRER_POLICY`
    
  3768.   * :setting:`SECURE_SSL_HOST`
    
  3769.   * :setting:`SECURE_SSL_REDIRECT`
    
  3770. * :setting:`SIGNING_BACKEND`
    
  3771. * :setting:`USE_X_FORWARDED_HOST`
    
  3772. * :setting:`USE_X_FORWARDED_PORT`
    
  3773. * :setting:`WSGI_APPLICATION`
    
  3774. 
    
  3775. Logging
    
  3776. -------
    
  3777. * :setting:`LOGGING`
    
  3778. * :setting:`LOGGING_CONFIG`
    
  3779. 
    
  3780. Models
    
  3781. ------
    
  3782. * :setting:`ABSOLUTE_URL_OVERRIDES`
    
  3783. * :setting:`FIXTURE_DIRS`
    
  3784. * :setting:`INSTALLED_APPS`
    
  3785. 
    
  3786. Security
    
  3787. --------
    
  3788. * Cross Site Request Forgery Protection
    
  3789. 
    
  3790.   * :setting:`CSRF_COOKIE_DOMAIN`
    
  3791.   * :setting:`CSRF_COOKIE_NAME`
    
  3792.   * :setting:`CSRF_COOKIE_PATH`
    
  3793.   * :setting:`CSRF_COOKIE_SAMESITE`
    
  3794.   * :setting:`CSRF_COOKIE_SECURE`
    
  3795.   * :setting:`CSRF_FAILURE_VIEW`
    
  3796.   * :setting:`CSRF_HEADER_NAME`
    
  3797.   * :setting:`CSRF_TRUSTED_ORIGINS`
    
  3798.   * :setting:`CSRF_USE_SESSIONS`
    
  3799. 
    
  3800. * :setting:`SECRET_KEY`
    
  3801. * :setting:`SECRET_KEY_FALLBACKS`
    
  3802. * :setting:`X_FRAME_OPTIONS`
    
  3803. 
    
  3804. Serialization
    
  3805. -------------
    
  3806. * :setting:`DEFAULT_CHARSET`
    
  3807. * :setting:`SERIALIZATION_MODULES`
    
  3808. 
    
  3809. Templates
    
  3810. ---------
    
  3811. * :setting:`TEMPLATES`
    
  3812. 
    
  3813. Testing
    
  3814. -------
    
  3815. * Database: :setting:`TEST <DATABASE-TEST>`
    
  3816. * :setting:`TEST_NON_SERIALIZED_APPS`
    
  3817. * :setting:`TEST_RUNNER`
    
  3818. 
    
  3819. URLs
    
  3820. ----
    
  3821. * :setting:`APPEND_SLASH`
    
  3822. * :setting:`PREPEND_WWW`
    
  3823. * :setting:`ROOT_URLCONF`