CINXE.COM
Settings | Django documentation | Django
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge"> <meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="ROBOTS" content="ALL" /> <meta name="MSSmartTagsPreventParsing" content="true" /> <meta name="Copyright" content="Django Software Foundation" /> <meta name="keywords" content="Python, Django, framework, open-source" /> <meta name="description" content="" /> <link rel="canonical" href="https://docs.djangoproject.com/en/5.1/ref/settings/"> <link rel="alternate" hreflang="el" href="https://docs.djangoproject.com/el/3.0/ref/settings/"> <link rel="alternate" hreflang="en" href="https://docs.djangoproject.com/en/3.0/ref/settings/"> <link rel="alternate" hreflang="es" href="https://docs.djangoproject.com/es/3.0/ref/settings/"> <link rel="alternate" hreflang="fr" href="https://docs.djangoproject.com/fr/3.0/ref/settings/"> <link rel="alternate" hreflang="id" href="https://docs.djangoproject.com/id/3.0/ref/settings/"> <link rel="alternate" hreflang="ja" href="https://docs.djangoproject.com/ja/3.0/ref/settings/"> <link rel="alternate" hreflang="ko" href="https://docs.djangoproject.com/ko/3.0/ref/settings/"> <link rel="alternate" hreflang="pl" href="https://docs.djangoproject.com/pl/3.0/ref/settings/"> <link rel="alternate" hreflang="pt-br" href="https://docs.djangoproject.com/pt-br/3.0/ref/settings/"> <link rel="alternate" hreflang="zh-hans" href="https://docs.djangoproject.com/zh-hans/3.0/ref/settings/"> <link rel="search" type="application/opensearchdescription+xml" href="https://docs.djangoproject.com/en/3.0/search/description/" title="Django documentation"> <!-- Favicons --> <link rel="apple-touch-icon" href="https://static.djangoproject.com/img/icon-touch.e4872c4da341.png"> <link rel="icon" sizes="192x192" href="https://static.djangoproject.com/img/icon-touch.e4872c4da341.png"> <link rel="shortcut icon" href="https://static.djangoproject.com/img/favicon.6dbf28c0650e.ico"> <meta name="msapplication-TileColor" content="#113228"> <meta name="msapplication-TileImage" content="https://static.djangoproject.com/img/icon-tile.b01ac0ef9f67.png"> <meta name="theme-color" content="#0C4B33"> <meta property="og:title" content="Settings | Django documentation" /> <meta property="og:description" content="The web framework for perfectionists with deadlines." /> <meta property="og:image" content="https://static.djangoproject.com/img/logos/django-logo-negative.1d528e2cb5fb.png" /> <meta property="og:image:alt" content="Django logo" /> <meta property="og:image:width" content="1200" /> <meta property="og:image:height" content="546" /> <meta property="og:image:type" content="image/png" /> <meta property="og:url" content="https://docs.djangoproject.com/en/3.0/ref/settings/" /> <meta property="og:site_name" content="Django Project" /> <meta property="twitter:creator" content="djangoproject" /> <meta property="twitter:site" content="djangoproject" /> <meta property="twitter:card" content="summary"> <title>Settings | Django documentation | Django</title> <link rel="stylesheet" href="https://static.djangoproject.com/css/output.fde294a46e8e.css" > <script src="https://static.djangoproject.com/js/lib/webfontloader/webfontloader.e75218f5f090.js"></script> <script> WebFont.load({ custom: { families: ['FontAwesome', 'Fira+Mono'], }, google: { families: ['Roboto:400italic,700italic,300,700,400:latin' ] }, classes: false, events: false, timeout: 1000 }); </script> <script src="https://static.djangoproject.com/js/lib/modernizr.3b36762e418a.js"></script> <script src="https://static.djangoproject.com/js/mod/switch-dark-mode.69777ee87b91.js"></script> </head> <body id="generic" class=""> <div role="banner" id="top"> <div class="container container--flex--wrap--mobile"> <a class="logo" href="https://www.djangoproject.com/">Django</a> <p class="meta">The web framework for perfectionists with deadlines.</p> <div class="mobile-toggle"> <button class="theme-toggle"> <div class="visually-hidden theme-label-when-auto">Toggle theme (current theme: auto)</div> <div class="visually-hidden theme-label-when-light">Toggle theme (current theme: light)</div> <div class="visually-hidden theme-label-when-dark">Toggle theme (current theme: dark)</div> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg aria-hidden="true" class="theme-icon-when-auto"> <use xlink:href="#icon-auto" /> </svg> <svg aria-hidden="true" class="theme-icon-when-dark"> <use xlink:href="#icon-moon" /> </svg> <svg aria-hidden="true" class="theme-icon-when-light"> <use xlink:href="#icon-sun" /> </svg> </button> </div> <button class="menu-button"> <i class="icon icon-reorder"></i> <span class="visuallyhidden">Menu</span> </button> <div role="navigation"> <ul> <li> <a href="https://www.djangoproject.com/start/overview/">Overview</a> </li> <li> <a href="https://www.djangoproject.com/download/">Download</a> </li> <li class="active"> <a href="https://docs.djangoproject.com/">Documentation</a> </li> <li> <a href="https://www.djangoproject.com/weblog/">News</a> </li> <li> <a href="https://www.djangoproject.com/community/">Community</a> </li> <li> <a href="https://github.com/django/django" target="_blank" rel="noopener">Code</a> </li> <li> <a href="https://code.djangoproject.com/">Issues</a> </li> <li> <a href="https://www.djangoproject.com/foundation/">About</a> </li> <li> <a href="https://www.djangoproject.com/fundraising/">♥ Donate</a> </li> <li> <button class="theme-toggle"> <div class="visually-hidden theme-label-when-auto">Toggle theme (current theme: auto)</div> <div class="visually-hidden theme-label-when-light">Toggle theme (current theme: light)</div> <div class="visually-hidden theme-label-when-dark">Toggle theme (current theme: dark)</div> <div class="visually-hidden">Toggle Light / Dark / Auto color theme</div> <svg aria-hidden="true" class="theme-icon-when-auto"> <use xlink:href="#icon-auto" /> </svg> <svg aria-hidden="true" class="theme-icon-when-dark"> <use xlink:href="#icon-moon" /> </svg> <svg aria-hidden="true" class="theme-icon-when-light"> <use xlink:href="#icon-sun" /> </svg> </button> </li> </ul> </div> </div> </div> <div class="copy-banner"> <div class="container container--flex container--flex--wrap--mobile "> <h1><a href="https://docs.djangoproject.com/en/3.0/">Documentation</a></h1> <form action="https://docs.djangoproject.com/en/3.0/search/" class="search form-input" role="search"> <label class="visuallyhidden" for="id_q">Search:</label> <input type="search" name="q" placeholder="Search 3.0 documentation" id="id_q"> <button type="submit"> <i class="icon icon-search"></i> <span class="visuallyhidden">Search</span> </button> </form> </div> </div> <div id="billboard"></div> <div class="container sidebar-right"> <div role="main"> <div id="version-switcher"> <ul id="faq-link"> <li class="current-link"> <a href="https://docs.djangoproject.com/en/3.0/faq/help/"> <span>Getting Help</span> </a> </li> </ul> <ul id="doc-languages" class="language-switcher doc-switcher"> <li class="other"> <a href="https://docs.djangoproject.com/el/3.0/ref/settings/">el</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/es/3.0/ref/settings/">es</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/fr/3.0/ref/settings/">fr</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/id/3.0/ref/settings/">id</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/ja/3.0/ref/settings/">ja</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/ko/3.0/ref/settings/">ko</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/pl/3.0/ref/settings/">pl</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/pt-br/3.0/ref/settings/">pt-br</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/zh-hans/3.0/ref/settings/">zh-hans</a> </li> <li class="current" title="Click on the links on the left to switch to another language."> <span>Language: <strong>en</strong></span> </li> </ul> <ul id="doc-versions" class="version-switcher doc-switcher"> <li class="other"> <a href="https://docs.djangoproject.com/en/1.8/ref/settings/">1.8</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/1.10/ref/settings/">1.10</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/1.11/ref/settings/">1.11</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/2.0/ref/settings/">2.0</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/2.1/ref/settings/">2.1</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/2.2/ref/settings/">2.2</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/3.1/ref/settings/">3.1</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/3.2/ref/settings/">3.2</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/4.0/ref/settings/">4.0</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/4.1/ref/settings/">4.1</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/4.2/ref/settings/">4.2</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/5.0/ref/settings/">5.0</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/5.1/ref/settings/">5.1</a> </li> <li class="other"> <a href="https://docs.djangoproject.com/en/dev/ref/settings/">dev</a> </li> <li class="current" title="This document describes Django 3.0. Click on the links on the left to see other versions."> <span>Documentation version: <strong>3.0</strong> </span> </li> </ul> <ul id="backtotop-link"> <li class="current-link"> <a href="#top" aria-label="Back to top" class="icon-chevron-up-align"><i class="icon icon-chevron-up"></i></a> </li> </ul> </div> <div id="docs-content"> <div class="section" id="s-settings"> <span id="settings"></span><h1>Settings<a class="headerlink" href="#settings" title="Permalink to this headline">¶</a></h1> <div class="contents local topic" id="contents"> <ul class="simple"> <li><a class="reference internal" href="#core-settings" id="id12">Core Settings</a></li> <li><a class="reference internal" href="#auth" id="id13">Auth</a></li> <li><a class="reference internal" href="#messages" id="id14">Messages</a></li> <li><a class="reference internal" href="#sessions" id="id15">Sessions</a></li> <li><a class="reference internal" href="#sites" id="id16">Sites</a></li> <li><a class="reference internal" href="#static-files" id="id17">Static Files</a></li> <li><a class="reference internal" href="#core-settings-topical-index" id="id18">Core Settings Topical Index</a></li> </ul> </div> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Be careful when you override settings, especially when the default value is a non-empty list or dictionary, such as <a class="reference internal" href="#std:setting-STATICFILES_FINDERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATICFILES_FINDERS</span></code></a>. Make sure you keep the components required by the features of Django you wish to use.</p> </div> <div class="section" id="s-core-settings"> <span id="core-settings"></span><h2><a class="toc-backref" href="#id12">Core Settings</a><a class="headerlink" href="#core-settings" title="Permalink to this headline">¶</a></h2> <p>Here’s a list of settings available in Django core and their default values. Settings provided by contrib apps are listed below, followed by a topical index of the core settings. For introductory material, see the <a class="reference internal" href="../../topics/settings/"><span class="doc">settings topic guide</span></a>.</p> <div class="section" id="s-absolute-url-overrides"> <span id="s-std:setting-ABSOLUTE_URL_OVERRIDES"></span><span id="absolute-url-overrides"></span><span id="std:setting-ABSOLUTE_URL_OVERRIDES"></span><h3><code class="docutils literal notranslate"><span class="pre">ABSOLUTE_URL_OVERRIDES</span></code><a class="headerlink" href="#absolute-url-overrides" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dictionary)</p> <p>A dictionary mapping <code class="docutils literal notranslate"><span class="pre">"app_label.model_name"</span></code> strings to functions that take a model object and return its URL. This is a way of inserting or overriding <code class="docutils literal notranslate"><span class="pre">get_absolute_url()</span></code> methods on a per-installation basis. Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">ABSOLUTE_URL_OVERRIDES</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'blogs.weblog'</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">o</span><span class="p">:</span> <span class="s2">"/blogs/</span><span class="si">%s</span><span class="s2">/"</span> <span class="o">%</span> <span class="n">o</span><span class="o">.</span><span class="n">slug</span><span class="p">,</span> <span class="s1">'news.story'</span><span class="p">:</span> <span class="k">lambda</span> <span class="n">o</span><span class="p">:</span> <span class="s2">"/stories/</span><span class="si">%s</span><span class="s2">/</span><span class="si">%s</span><span class="s2">/"</span> <span class="o">%</span> <span class="p">(</span><span class="n">o</span><span class="o">.</span><span class="n">pub_year</span><span class="p">,</span> <span class="n">o</span><span class="o">.</span><span class="n">slug</span><span class="p">),</span> <span class="p">}</span> </pre></div> </div> <p>The model name used in this setting should be all lowercase, regardless of the case of the actual model class name.</p> </div> <div class="section" id="s-admins"> <span id="s-std:setting-ADMINS"></span><span id="admins"></span><span id="std:setting-ADMINS"></span><h3><code class="docutils literal notranslate"><span class="pre">ADMINS</span></code><a class="headerlink" href="#admins" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of all the people who get code error notifications. When <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG=False</span></code></a> and <a class="reference internal" href="../../topics/logging/#django.utils.log.AdminEmailHandler" title="django.utils.log.AdminEmailHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">AdminEmailHandler</span></code></a> is configured in <a class="reference internal" href="#std:setting-LOGGING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGGING</span></code></a> (done by default), Django emails these people the details of exceptions raised in the request/response cycle.</p> <p>Each item in the list should be a tuple of (Full name, email address). Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[(</span><span class="s1">'John'</span><span class="p">,</span> <span class="s1">'john@example.com'</span><span class="p">),</span> <span class="p">(</span><span class="s1">'Mary'</span><span class="p">,</span> <span class="s1">'mary@example.com'</span><span class="p">)]</span> </pre></div> </div> </div> <div class="section" id="s-allowed-hosts"> <span id="s-std:setting-ALLOWED_HOSTS"></span><span id="allowed-hosts"></span><span id="std:setting-ALLOWED_HOSTS"></span><h3><code class="docutils literal notranslate"><span class="pre">ALLOWED_HOSTS</span></code><a class="headerlink" href="#allowed-hosts" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of strings representing the host/domain names that this Django site can serve. This is a security measure to prevent <a class="reference internal" href="../../topics/security/#host-headers-virtual-hosting"><span class="std std-ref">HTTP Host header attacks</span></a>, which are possible even under many seemingly-safe web server configurations.</p> <p>Values in this list can be fully qualified names (e.g. <code class="docutils literal notranslate"><span class="pre">'www.example.com'</span></code>), in which case they will be matched against the request’s <code class="docutils literal notranslate"><span class="pre">Host</span></code> header exactly (case-insensitive, not including port). A value beginning with a period can be used as a subdomain wildcard: <code class="docutils literal notranslate"><span class="pre">'.example.com'</span></code> will match <code class="docutils literal notranslate"><span class="pre">example.com</span></code>, <code class="docutils literal notranslate"><span class="pre">www.example.com</span></code>, and any other subdomain of <code class="docutils literal notranslate"><span class="pre">example.com</span></code>. A value of <code class="docutils literal notranslate"><span class="pre">'*'</span></code> will match anything; in this case you are responsible to provide your own validation of the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header (perhaps in a middleware; if so this middleware must be listed first in <a class="reference internal" href="#std:setting-MIDDLEWARE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a>).</p> <p>Django also allows the <a class="reference external" href="https://en.wikipedia.org/wiki/Fully_qualified_domain_name">fully qualified domain name (FQDN)</a> of any entries. Some browsers include a trailing dot in the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header which Django strips when performing host validation.</p> <p>If the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header (or <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Host</span></code> if <a class="reference internal" href="#std:setting-USE_X_FORWARDED_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_HOST</span></code></a> is enabled) does not match any value in this list, the <a class="reference internal" href="../request-response/#django.http.HttpRequest.get_host" title="django.http.HttpRequest.get_host"><code class="xref py py-meth docutils literal notranslate"><span class="pre">django.http.HttpRequest.get_host()</span></code></a> method will raise <a class="reference internal" href="../exceptions/#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SuspiciousOperation</span></code></a>.</p> <p>When <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code> and <code class="docutils literal notranslate"><span class="pre">ALLOWED_HOSTS</span></code> is empty, the host is validated against <code class="docutils literal notranslate"><span class="pre">['localhost',</span> <span class="pre">'127.0.0.1',</span> <span class="pre">'[::1]']</span></code>.</p> <p><code class="docutils literal notranslate"><span class="pre">ALLOWED_HOSTS</span></code> is also <a class="reference internal" href="../../topics/testing/advanced/#topics-testing-advanced-multiple-hosts"><span class="std std-ref">checked when running tests</span></a>.</p> <p>This validation only applies via <a class="reference internal" href="../request-response/#django.http.HttpRequest.get_host" title="django.http.HttpRequest.get_host"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_host()</span></code></a>; if your code accesses the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header directly from <code class="docutils literal notranslate"><span class="pre">request.META</span></code> you are bypassing this security protection.</p> </div> <div class="section" id="s-append-slash"> <span id="s-std:setting-APPEND_SLASH"></span><span id="append-slash"></span><span id="std:setting-APPEND_SLASH"></span><h3><code class="docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code><a class="headerlink" href="#append-slash" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>When set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, if the request URL does not match any of the patterns in the URLconf and it doesn’t end in a slash, an HTTP redirect is issued to the same URL with a slash appended. Note that the redirect may cause any data submitted in a POST request to be lost.</p> <p>The <a class="reference internal" href="#std:setting-APPEND_SLASH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code></a> setting is only used if <a class="reference internal" href="../middleware/#django.middleware.common.CommonMiddleware" title="django.middleware.common.CommonMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommonMiddleware</span></code></a> is installed (see <a class="reference internal" href="../../topics/http/middleware/"><span class="doc">Middleware</span></a>). See also <a class="reference internal" href="#std:setting-PREPEND_WWW"><code class="xref std std-setting docutils literal notranslate"><span class="pre">PREPEND_WWW</span></code></a>.</p> </div> <div class="section" id="s-caches"> <span id="s-std:setting-CACHES"></span><span id="caches"></span><span id="std:setting-CACHES"></span><h3><code class="docutils literal notranslate"><span class="pre">CACHES</span></code><a class="headerlink" href="#caches" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="s1">'default'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'BACKEND'</span><span class="p">:</span> <span class="s1">'django.core.cache.backends.locmem.LocMemCache'</span><span class="p">,</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </div> <p>A dictionary containing the settings for all caches to be used with Django. It is a nested dictionary whose contents maps cache aliases to a dictionary containing the options for an individual cache.</p> <p>The <a class="reference internal" href="#std:setting-CACHES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CACHES</span></code></a> setting must configure a <code class="docutils literal notranslate"><span class="pre">default</span></code> cache; any number of additional caches may also be specified. If you are using a cache backend other than the local memory cache, or you need to define multiple caches, other options will be required. The following cache options are available.</p> <div class="section" id="s-backend"> <span id="s-std:setting-CACHES-BACKEND"></span><span id="backend"></span><span id="std:setting-CACHES-BACKEND"></span><h4><code class="docutils literal notranslate"><span class="pre">BACKEND</span></code><a class="headerlink" href="#backend" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The cache backend to use. The built-in cache backends are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.db.DatabaseCache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.dummy.DummyCache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.filebased.FileBasedCache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.locmem.LocMemCache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.memcached.MemcachedCache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.core.cache.backends.memcached.PyLibMCCache'</span></code></li> </ul> <p>You can use a cache backend that doesn’t ship with Django by setting <a class="reference internal" href="#std:setting-CACHES-BACKEND"><code class="xref std std-setting docutils literal notranslate"><span class="pre">BACKEND</span></code></a> to a fully-qualified path of a cache backend class (i.e. <code class="docutils literal notranslate"><span class="pre">mypackage.backends.whatever.WhateverCache</span></code>).</p> </div> <div class="section" id="s-key-function"> <span id="s-std:setting-CACHES-KEY_FUNCTION"></span><span id="key-function"></span><span id="std:setting-CACHES-KEY_FUNCTION"></span><h4><code class="docutils literal notranslate"><span class="pre">KEY_FUNCTION</span></code><a class="headerlink" href="#key-function" title="Permalink to this headline">¶</a></h4> <p>A string containing a dotted path to a function (or any callable) that defines how to compose a prefix, version and key into a final cache key. The default implementation is equivalent to the function:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">make_key</span><span class="p">(</span><span class="n">key</span><span class="p">,</span> <span class="n">key_prefix</span><span class="p">,</span> <span class="n">version</span><span class="p">):</span> <span class="k">return</span> <span class="s1">':'</span><span class="o">.</span><span class="n">join</span><span class="p">([</span><span class="n">key_prefix</span><span class="p">,</span> <span class="nb">str</span><span class="p">(</span><span class="n">version</span><span class="p">),</span> <span class="n">key</span><span class="p">])</span> </pre></div> </div> <p>You may use any key function you want, as long as it has the same argument signature.</p> <p>See the <a class="reference internal" href="../../topics/cache/#cache-key-transformation"><span class="std std-ref">cache documentation</span></a> for more information.</p> </div> <div class="section" id="s-key-prefix"> <span id="s-std:setting-CACHES-KEY_PREFIX"></span><span id="key-prefix"></span><span id="std:setting-CACHES-KEY_PREFIX"></span><h4><code class="docutils literal notranslate"><span class="pre">KEY_PREFIX</span></code><a class="headerlink" href="#key-prefix" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>A string that will be automatically included (prepended by default) to all cache keys used by the Django server.</p> <p>See the <a class="reference internal" href="../../topics/cache/#cache-key-prefixing"><span class="std std-ref">cache documentation</span></a> for more information.</p> </div> <div class="section" id="s-location"> <span id="s-std:setting-CACHES-LOCATION"></span><span id="location"></span><span id="std:setting-CACHES-LOCATION"></span><h4><code class="docutils literal notranslate"><span class="pre">LOCATION</span></code><a class="headerlink" href="#location" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The location of the cache to use. This might be the directory for a file system cache, a host and port for a memcache server, or an identifying name for a local memory cache. e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">CACHES</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'default'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'BACKEND'</span><span class="p">:</span> <span class="s1">'django.core.cache.backends.filebased.FileBasedCache'</span><span class="p">,</span> <span class="s1">'LOCATION'</span><span class="p">:</span> <span class="s1">'/var/tmp/django_cache'</span><span class="p">,</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </div> </div> <div class="section" id="s-options"> <span id="s-std:setting-CACHES-OPTIONS"></span><span id="options"></span><span id="std:setting-CACHES-OPTIONS"></span><h4><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code><a class="headerlink" href="#options" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>Extra parameters to pass to the cache backend. Available parameters vary depending on your cache backend.</p> <p>Some information on available parameters can be found in the <a class="reference internal" href="../../topics/cache/#cache-arguments"><span class="std std-ref">cache arguments</span></a> documentation. For more information, consult your backend module’s own documentation.</p> </div> <div class="section" id="s-timeout"> <span id="s-std:setting-CACHES-TIMEOUT"></span><span id="timeout"></span><span id="std:setting-CACHES-TIMEOUT"></span><h4><code class="docutils literal notranslate"><span class="pre">TIMEOUT</span></code><a class="headerlink" href="#timeout" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">300</span></code></p> <p>The number of seconds before a cache entry is considered stale. If the value of this settings is <code class="docutils literal notranslate"><span class="pre">None</span></code>, cache entries will not expire.</p> </div> <div class="section" id="s-version"> <span id="s-std:setting-CACHES-VERSION"></span><span id="version"></span><span id="std:setting-CACHES-VERSION"></span><h4><code class="docutils literal notranslate"><span class="pre">VERSION</span></code><a class="headerlink" href="#version" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">1</span></code></p> <p>The default version number for cache keys generated by the Django server.</p> <p>See the <a class="reference internal" href="../../topics/cache/#cache-versioning"><span class="std std-ref">cache documentation</span></a> for more information.</p> </div> </div> <div class="section" id="s-cache-middleware-alias"> <span id="s-std:setting-CACHE_MIDDLEWARE_ALIAS"></span><span id="cache-middleware-alias"></span><span id="std:setting-CACHE_MIDDLEWARE_ALIAS"></span><h3><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_ALIAS</span></code><a class="headerlink" href="#cache-middleware-alias" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'default'</span></code></p> <p>The cache connection to use for the <a class="reference internal" href="../../topics/cache/#the-per-site-cache"><span class="std std-ref">cache middleware</span></a>.</p> </div> <div class="section" id="s-cache-middleware-key-prefix"> <span id="s-std:setting-CACHE_MIDDLEWARE_KEY_PREFIX"></span><span id="cache-middleware-key-prefix"></span><span id="std:setting-CACHE_MIDDLEWARE_KEY_PREFIX"></span><h3><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_KEY_PREFIX</span></code><a class="headerlink" href="#cache-middleware-key-prefix" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>A string which will be prefixed to the cache keys generated by the <a class="reference internal" href="../../topics/cache/#the-per-site-cache"><span class="std std-ref">cache middleware</span></a>. This prefix is combined with the <a class="reference internal" href="#std:setting-CACHES-KEY_PREFIX"><code class="xref std std-setting docutils literal notranslate"><span class="pre">KEY_PREFIX</span></code></a> setting; it does not replace it.</p> <p>See <a class="reference internal" href="../../topics/cache/"><span class="doc">Django’s cache framework</span></a>.</p> </div> <div class="section" id="s-cache-middleware-seconds"> <span id="s-std:setting-CACHE_MIDDLEWARE_SECONDS"></span><span id="cache-middleware-seconds"></span><span id="std:setting-CACHE_MIDDLEWARE_SECONDS"></span><h3><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_SECONDS</span></code><a class="headerlink" href="#cache-middleware-seconds" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">600</span></code></p> <p>The default number of seconds to cache a page for the <a class="reference internal" href="../../topics/cache/#the-per-site-cache"><span class="std std-ref">cache middleware</span></a>.</p> <p>See <a class="reference internal" href="../../topics/cache/"><span class="doc">Django’s cache framework</span></a>.</p> <span class="target" id="settings-csrf"></span></div> <div class="section" id="s-csrf-cookie-age"> <span id="s-std:setting-CSRF_COOKIE_AGE"></span><span id="csrf-cookie-age"></span><span id="std:setting-CSRF_COOKIE_AGE"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_AGE</span></code><a class="headerlink" href="#csrf-cookie-age" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">31449600</span></code> (approximately 1 year, in seconds)</p> <p>The age of CSRF cookies, in seconds.</p> <p>The reason for setting a long-lived expiration time is to avoid problems in the case of a user closing a browser or bookmarking a page and then loading that page from a browser cache. Without persistent cookies, the form submission would fail in this case.</p> <p>Some browsers (specifically Internet Explorer) can disallow the use of persistent cookies or can have the indexes to the cookie jar corrupted on disk, thereby causing CSRF protection checks to (sometimes intermittently) fail. Change this setting to <code class="docutils literal notranslate"><span class="pre">None</span></code> to use session-based CSRF cookies, which keep the cookies in-memory instead of on persistent storage.</p> </div> <div class="section" id="s-csrf-cookie-domain"> <span id="s-std:setting-CSRF_COOKIE_DOMAIN"></span><span id="csrf-cookie-domain"></span><span id="std:setting-CSRF_COOKIE_DOMAIN"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_DOMAIN</span></code><a class="headerlink" href="#csrf-cookie-domain" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The domain to be used when setting the CSRF cookie. This can be useful for easily allowing cross-subdomain requests to be excluded from the normal cross site request forgery protection. It should be set to a string such as <code class="docutils literal notranslate"><span class="pre">"example.com"</span></code> to allow a POST request from a form on one subdomain to be accepted by a view served from another subdomain.</p> <p>Please note that the presence of this setting does not imply that Django’s CSRF protection is safe from cross-subdomain attacks by default - please see the <a class="reference internal" href="../csrf/#csrf-limitations"><span class="std std-ref">CSRF limitations</span></a> section.</p> </div> <div class="section" id="s-csrf-cookie-httponly"> <span id="s-std:setting-CSRF_COOKIE_HTTPONLY"></span><span id="csrf-cookie-httponly"></span><span id="std:setting-CSRF_COOKIE_HTTPONLY"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_HTTPONLY</span></code><a class="headerlink" href="#csrf-cookie-httponly" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code> flag on the CSRF cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, client-side JavaScript will not be able to access the CSRF cookie.</p> <p>Designating the CSRF cookie as <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code> doesn’t offer any practical protection because CSRF is only to protect against cross-domain attacks. If an attacker can read the cookie via JavaScript, they’re already on the same domain as far as the browser knows, so they can do anything they like anyway. (XSS is a much bigger hole than CSRF.)</p> <p>Although the setting offers little practical benefit, it’s sometimes required by security auditors.</p> <p>If you enable this and need to send the value of the CSRF token with an AJAX request, your JavaScript must pull the value <a class="reference internal" href="../csrf/#acquiring-csrf-token-from-html"><span class="std std-ref">from a hidden CSRF token form input</span></a> instead of <a class="reference internal" href="../csrf/#acquiring-csrf-token-from-cookie"><span class="std std-ref">from the cookie</span></a>.</p> <p>See <a class="reference internal" href="#std:setting-SESSION_COOKIE_HTTPONLY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_HTTPONLY</span></code></a> for details on <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code>.</p> </div> <div class="section" id="s-csrf-cookie-name"> <span id="s-std:setting-CSRF_COOKIE_NAME"></span><span id="csrf-cookie-name"></span><span id="std:setting-CSRF_COOKIE_NAME"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_NAME</span></code><a class="headerlink" href="#csrf-cookie-name" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'csrftoken'</span></code></p> <p>The name of the cookie to use for the CSRF authentication token. This can be whatever you want (as long as it’s different from the other cookie names in your application). See <a class="reference internal" href="../csrf/"><span class="doc">Cross Site Request Forgery protection</span></a>.</p> </div> <div class="section" id="s-csrf-cookie-path"> <span id="s-std:setting-CSRF_COOKIE_PATH"></span><span id="csrf-cookie-path"></span><span id="std:setting-CSRF_COOKIE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_PATH</span></code><a class="headerlink" href="#csrf-cookie-path" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'/'</span></code></p> <p>The path set on the CSRF cookie. This should either match the URL path of your Django installation or be a parent of that path.</p> <p>This is useful if you have multiple Django instances running under the same hostname. They can use different cookie paths, and each instance will only see its own CSRF cookie.</p> </div> <div class="section" id="s-csrf-cookie-samesite"> <span id="s-std:setting-CSRF_COOKIE_SAMESITE"></span><span id="csrf-cookie-samesite"></span><span id="std:setting-CSRF_COOKIE_SAMESITE"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_SAMESITE</span></code><a class="headerlink" href="#csrf-cookie-samesite" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'Lax'</span></code></p> <p>The value of the <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite">SameSite</a> flag on the CSRF cookie. This flag prevents the cookie from being sent in cross-site requests.</p> <p>See <a class="reference internal" href="#std:setting-SESSION_COOKIE_SAMESITE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_SAMESITE</span></code></a> for details about <code class="docutils literal notranslate"><span class="pre">SameSite</span></code>.</p> </div> <div class="section" id="s-csrf-cookie-secure"> <span id="s-std:setting-CSRF_COOKIE_SECURE"></span><span id="csrf-cookie-secure"></span><span id="std:setting-CSRF_COOKIE_SECURE"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_SECURE</span></code><a class="headerlink" href="#csrf-cookie-secure" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use a secure cookie for the CSRF cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, the cookie will be marked as “secure”, which means browsers may ensure that the cookie is only sent with an HTTPS connection.</p> </div> <div class="section" id="s-csrf-use-sessions"> <span id="s-std:setting-CSRF_USE_SESSIONS"></span><span id="csrf-use-sessions"></span><span id="std:setting-CSRF_USE_SESSIONS"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_USE_SESSIONS</span></code><a class="headerlink" href="#csrf-use-sessions" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to store the CSRF token in the user’s session instead of in a cookie. It requires the use of <a class="reference internal" href="../../topics/http/sessions/#module-django.contrib.sessions" title="django.contrib.sessions: Provides session management for Django projects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sessions</span></code></a>.</p> <p>Storing the CSRF token in a cookie (Django’s default) is safe, but storing it in the session is common practice in other web frameworks and therefore sometimes demanded by security auditors.</p> <p>Since the <a class="reference internal" href="../views/#error-views"><span class="std std-ref">default error views</span></a> require the CSRF token, <a class="reference internal" href="../middleware/#django.contrib.sessions.middleware.SessionMiddleware" title="django.contrib.sessions.middleware.SessionMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SessionMiddleware</span></code></a> must appear in <a class="reference internal" href="#std:setting-MIDDLEWARE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a> before any middleware that may raise an exception to trigger an error view (such as <a class="reference internal" href="../exceptions/#django.core.exceptions.PermissionDenied" title="django.core.exceptions.PermissionDenied"><code class="xref py py-exc docutils literal notranslate"><span class="pre">PermissionDenied</span></code></a>) if you’re using <code class="docutils literal notranslate"><span class="pre">CSRF_USE_SESSIONS</span></code>. See <a class="reference internal" href="../middleware/#middleware-ordering"><span class="std std-ref">Middleware ordering</span></a>.</p> </div> <div class="section" id="s-csrf-failure-view"> <span id="s-std:setting-CSRF_FAILURE_VIEW"></span><span id="csrf-failure-view"></span><span id="std:setting-CSRF_FAILURE_VIEW"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_FAILURE_VIEW</span></code><a class="headerlink" href="#csrf-failure-view" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.views.csrf.csrf_failure'</span></code></p> <p>A dotted path to the view function to be used when an incoming request is rejected by the <a class="reference internal" href="../csrf/"><span class="doc">CSRF protection</span></a>. The function should have this signature:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="k">def</span> <span class="nf">csrf_failure</span><span class="p">(</span><span class="n">request</span><span class="p">,</span> <span class="n">reason</span><span class="o">=</span><span class="s2">""</span><span class="p">):</span> <span class="o">...</span> </pre></div> </div> <p>where <code class="docutils literal notranslate"><span class="pre">reason</span></code> is a short message (intended for developers or logging, not for end users) indicating the reason the request was rejected. It should return an <a class="reference internal" href="../request-response/#django.http.HttpResponseForbidden" title="django.http.HttpResponseForbidden"><code class="xref py py-class docutils literal notranslate"><span class="pre">HttpResponseForbidden</span></code></a>.</p> <p><code class="docutils literal notranslate"><span class="pre">django.views.csrf.csrf_failure()</span></code> accepts an additional <code class="docutils literal notranslate"><span class="pre">template_name</span></code> parameter that defaults to <code class="docutils literal notranslate"><span class="pre">'403_csrf.html'</span></code>. If a template with that name exists, it will be used to render the page.</p> </div> <div class="section" id="s-csrf-header-name"> <span id="s-std:setting-CSRF_HEADER_NAME"></span><span id="csrf-header-name"></span><span id="std:setting-CSRF_HEADER_NAME"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_HEADER_NAME</span></code><a class="headerlink" href="#csrf-header-name" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'HTTP_X_CSRFTOKEN'</span></code></p> <p>The name of the request header used for CSRF authentication.</p> <p>As with other HTTP headers in <code class="docutils literal notranslate"><span class="pre">request.META</span></code>, the header name received from the server is normalized by converting all characters to uppercase, replacing any hyphens with underscores, and adding an <code class="docutils literal notranslate"><span class="pre">'HTTP_'</span></code> prefix to the name. For example, if your client sends a <code class="docutils literal notranslate"><span class="pre">'X-XSRF-TOKEN'</span></code> header, the setting should be <code class="docutils literal notranslate"><span class="pre">'HTTP_X_XSRF_TOKEN'</span></code>.</p> </div> <div class="section" id="s-csrf-trusted-origins"> <span id="s-std:setting-CSRF_TRUSTED_ORIGINS"></span><span id="csrf-trusted-origins"></span><span id="std:setting-CSRF_TRUSTED_ORIGINS"></span><h3><code class="docutils literal notranslate"><span class="pre">CSRF_TRUSTED_ORIGINS</span></code><a class="headerlink" href="#csrf-trusted-origins" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of hosts which are trusted origins for unsafe requests (e.g. <code class="docutils literal notranslate"><span class="pre">POST</span></code>). For a <a class="reference internal" href="../request-response/#django.http.HttpRequest.is_secure" title="django.http.HttpRequest.is_secure"><code class="xref py py-meth docutils literal notranslate"><span class="pre">secure</span></code></a> unsafe request, Django’s CSRF protection requires that the request have a <code class="docutils literal notranslate"><span class="pre">Referer</span></code> header that matches the origin present in the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header. This prevents, for example, a <code class="docutils literal notranslate"><span class="pre">POST</span></code> request from <code class="docutils literal notranslate"><span class="pre">subdomain.example.com</span></code> from succeeding against <code class="docutils literal notranslate"><span class="pre">api.example.com</span></code>. If you need cross-origin unsafe requests over HTTPS, continuing the example, add <code class="docutils literal notranslate"><span class="pre">"subdomain.example.com"</span></code> to this list. The setting also supports subdomains, so you could add <code class="docutils literal notranslate"><span class="pre">".example.com"</span></code>, for example, to allow access from all subdomains of <code class="docutils literal notranslate"><span class="pre">example.com</span></code>.</p> </div> <div class="section" id="s-databases"> <span id="s-std:setting-DATABASES"></span><span id="databases"></span><span id="std:setting-DATABASES"></span><h3><code class="docutils literal notranslate"><span class="pre">DATABASES</span></code><a class="headerlink" href="#databases" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dictionary)</p> <p>A dictionary containing the settings for all databases to be used with Django. It is a nested dictionary whose contents map a database alias to a dictionary containing the options for an individual database.</p> <p>The <a class="reference internal" href="#std:setting-DATABASES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATABASES</span></code></a> setting must configure a <code class="docutils literal notranslate"><span class="pre">default</span></code> database; any number of additional databases may also be specified.</p> <p>The simplest possible settings file is for a single-database setup using SQLite. This can be configured using the following:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DATABASES</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'default'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'ENGINE'</span><span class="p">:</span> <span class="s1">'django.db.backends.sqlite3'</span><span class="p">,</span> <span class="s1">'NAME'</span><span class="p">:</span> <span class="s1">'mydatabase'</span><span class="p">,</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </div> <p>When connecting to other database backends, such as MariaDB, MySQL, Oracle, or PostgreSQL, additional connection parameters will be required. See the <a class="reference internal" href="#std:setting-DATABASE-ENGINE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ENGINE</span></code></a> setting below on how to specify other database types. This example is for PostgreSQL:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DATABASES</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'default'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'ENGINE'</span><span class="p">:</span> <span class="s1">'django.db.backends.postgresql'</span><span class="p">,</span> <span class="s1">'NAME'</span><span class="p">:</span> <span class="s1">'mydatabase'</span><span class="p">,</span> <span class="s1">'USER'</span><span class="p">:</span> <span class="s1">'mydatabaseuser'</span><span class="p">,</span> <span class="s1">'PASSWORD'</span><span class="p">:</span> <span class="s1">'mypassword'</span><span class="p">,</span> <span class="s1">'HOST'</span><span class="p">:</span> <span class="s1">'127.0.0.1'</span><span class="p">,</span> <span class="s1">'PORT'</span><span class="p">:</span> <span class="s1">'5432'</span><span class="p">,</span> <span class="p">}</span> <span class="p">}</span> </pre></div> </div> <p>The following inner options that may be required for more complex configurations are available:</p> <div class="section" id="s-atomic-requests"> <span id="s-std:setting-DATABASE-ATOMIC_REQUESTS"></span><span id="atomic-requests"></span><span id="std:setting-DATABASE-ATOMIC_REQUESTS"></span><h4><code class="docutils literal notranslate"><span class="pre">ATOMIC_REQUESTS</span></code><a class="headerlink" href="#atomic-requests" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Set this to <code class="docutils literal notranslate"><span class="pre">True</span></code> to wrap each view in a transaction on this database. See <a class="reference internal" href="../../topics/db/transactions/#tying-transactions-to-http-requests"><span class="std std-ref">Tying transactions to HTTP requests</span></a>.</p> </div> <div class="section" id="s-autocommit"> <span id="s-std:setting-DATABASE-AUTOCOMMIT"></span><span id="autocommit"></span><span id="std:setting-DATABASE-AUTOCOMMIT"></span><h4><code class="docutils literal notranslate"><span class="pre">AUTOCOMMIT</span></code><a class="headerlink" href="#autocommit" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>Set this to <code class="docutils literal notranslate"><span class="pre">False</span></code> if you want to <a class="reference internal" href="../../topics/db/transactions/#deactivate-transaction-management"><span class="std std-ref">disable Django’s transaction management</span></a> and implement your own.</p> </div> <div class="section" id="s-engine"> <span id="s-std:setting-DATABASE-ENGINE"></span><span id="engine"></span><span id="std:setting-DATABASE-ENGINE"></span><h4><code class="docutils literal notranslate"><span class="pre">ENGINE</span></code><a class="headerlink" href="#engine" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The database backend to use. The built-in database backends are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.db.backends.postgresql'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.db.backends.mysql'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.db.backends.sqlite3'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.db.backends.oracle'</span></code></li> </ul> <p>You can use a database backend that doesn’t ship with Django by setting <code class="docutils literal notranslate"><span class="pre">ENGINE</span></code> to a fully-qualified path (i.e. <code class="docutils literal notranslate"><span class="pre">mypackage.backends.whatever</span></code>).</p> </div> <div class="section" id="s-host"> <span id="s-std:setting-HOST"></span><span id="host"></span><span id="std:setting-HOST"></span><h4><code class="docutils literal notranslate"><span class="pre">HOST</span></code><a class="headerlink" href="#host" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Which host to use when connecting to the database. An empty string means localhost. Not used with SQLite.</p> <p>If this value starts with a forward slash (<code class="docutils literal notranslate"><span class="pre">'/'</span></code>) and you’re using MySQL, MySQL will connect via a Unix socket to the specified socket. For example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="s2">"HOST"</span><span class="p">:</span> <span class="s1">'/var/run/mysql'</span> </pre></div> </div> <p>If you’re using MySQL and this value <em>doesn’t</em> start with a forward slash, then this value is assumed to be the host.</p> <p>If you’re using PostgreSQL, by default (empty <a class="reference internal" href="#std:setting-HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">HOST</span></code></a>), the connection to the database is done through UNIX domain sockets (‘local’ lines in <code class="docutils literal notranslate"><span class="pre">pg_hba.conf</span></code>). If your UNIX domain socket is not in the standard location, use the same value of <code class="docutils literal notranslate"><span class="pre">unix_socket_directory</span></code> from <code class="docutils literal notranslate"><span class="pre">postgresql.conf</span></code>. If you want to connect through TCP sockets, set <a class="reference internal" href="#std:setting-HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">HOST</span></code></a> to ‘localhost’ or ‘127.0.0.1’ (‘host’ lines in <code class="docutils literal notranslate"><span class="pre">pg_hba.conf</span></code>). On Windows, you should always define <a class="reference internal" href="#std:setting-HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">HOST</span></code></a>, as UNIX domain sockets are not available.</p> </div> <div class="section" id="s-name"> <span id="s-std:setting-NAME"></span><span id="name"></span><span id="std:setting-NAME"></span><h4><code class="docutils literal notranslate"><span class="pre">NAME</span></code><a class="headerlink" href="#name" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The name of the database to use. For SQLite, it’s the full path to the database file. When specifying the path, always use forward slashes, even on Windows (e.g. <code class="docutils literal notranslate"><span class="pre">C:/homes/user/mysite/sqlite3.db</span></code>).</p> </div> <div class="section" id="s-conn-max-age"> <span id="s-std:setting-CONN_MAX_AGE"></span><span id="conn-max-age"></span><span id="std:setting-CONN_MAX_AGE"></span><h4><code class="docutils literal notranslate"><span class="pre">CONN_MAX_AGE</span></code><a class="headerlink" href="#conn-max-age" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">0</span></code></p> <p>The lifetime of a database connection, as an integer of seconds. Use <code class="docutils literal notranslate"><span class="pre">0</span></code> to close database connections at the end of each request — Django’s historical behavior — and <code class="docutils literal notranslate"><span class="pre">None</span></code> for unlimited persistent connections.</p> </div> <div class="section" id="s-std:setting-OPTIONS"> <span id="s-id1"></span><span id="std:setting-OPTIONS"></span><span id="id1"></span><h4><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code><a class="headerlink" href="#std:setting-OPTIONS" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dictionary)</p> <p>Extra parameters to use when connecting to the database. Available parameters vary depending on your database backend.</p> <p>Some information on available parameters can be found in the <a class="reference internal" href="../databases/"><span class="doc">Database Backends</span></a> documentation. For more information, consult your backend module’s own documentation.</p> </div> <div class="section" id="s-password"> <span id="s-std:setting-PASSWORD"></span><span id="password"></span><span id="std:setting-PASSWORD"></span><h4><code class="docutils literal notranslate"><span class="pre">PASSWORD</span></code><a class="headerlink" href="#password" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The password to use when connecting to the database. Not used with SQLite.</p> </div> <div class="section" id="s-port"> <span id="s-std:setting-PORT"></span><span id="port"></span><span id="std:setting-PORT"></span><h4><code class="docutils literal notranslate"><span class="pre">PORT</span></code><a class="headerlink" href="#port" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The port to use when connecting to the database. An empty string means the default port. Not used with SQLite.</p> </div> <div class="section" id="s-time-zone"> <span id="s-std:setting-DATABASE-TIME_ZONE"></span><span id="time-zone"></span><span id="std:setting-DATABASE-TIME_ZONE"></span><h4><code class="docutils literal notranslate"><span class="pre">TIME_ZONE</span></code><a class="headerlink" href="#time-zone" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>A string representing the time zone for datetimes stored in this database (assuming that it doesn’t support time zones) or <code class="docutils literal notranslate"><span class="pre">None</span></code>. This inner option of the <a class="reference internal" href="#std:setting-DATABASES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATABASES</span></code></a> setting accepts the same values as the general <a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a> setting.</p> <p>This allows interacting with third-party databases that store datetimes in local time rather than UTC. To avoid issues around DST changes, you shouldn’t set this option for databases managed by Django.</p> <p>When <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code> and the database doesn’t support time zones (e.g. SQLite, MySQL, Oracle), Django reads and writes datetimes in local time according to this option if it is set and in UTC if it isn’t.</p> <p>When <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code> and the database supports time zones (e.g. PostgreSQL), it is an error to set this option.</p> <p>When <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, it is an error to set this option.</p> </div> <div class="section" id="s-disable-server-side-cursors"> <span id="s-std:setting-DATABASE-DISABLE_SERVER_SIDE_CURSORS"></span><span id="disable-server-side-cursors"></span><span id="std:setting-DATABASE-DISABLE_SERVER_SIDE_CURSORS"></span><h4><code class="docutils literal notranslate"><span class="pre">DISABLE_SERVER_SIDE_CURSORS</span></code><a class="headerlink" href="#disable-server-side-cursors" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Set this to <code class="docutils literal notranslate"><span class="pre">True</span></code> if you want to disable the use of server-side cursors with <a class="reference internal" href="../models/querysets/#django.db.models.query.QuerySet.iterator" title="django.db.models.query.QuerySet.iterator"><code class="xref py py-meth docutils literal notranslate"><span class="pre">QuerySet.iterator()</span></code></a>. <a class="reference internal" href="../databases/#transaction-pooling-server-side-cursors"><span class="std std-ref">Transaction pooling and server-side cursors</span></a> describes the use case.</p> <p>This is a PostgreSQL-specific setting.</p> </div> <div class="section" id="s-user"> <span id="s-std:setting-USER"></span><span id="user"></span><span id="std:setting-USER"></span><h4><code class="docutils literal notranslate"><span class="pre">USER</span></code><a class="headerlink" href="#user" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>The username to use when connecting to the database. Not used with SQLite.</p> </div> <div class="section" id="s-test"> <span id="s-std:setting-DATABASE-TEST"></span><span id="test"></span><span id="std:setting-DATABASE-TEST"></span><h4><code class="docutils literal notranslate"><span class="pre">TEST</span></code><a class="headerlink" href="#test" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dictionary)</p> <p>A dictionary of settings for test databases; for more details about the creation and use of test databases, see <a class="reference internal" href="../../topics/testing/overview/#the-test-database"><span class="std std-ref">The test database</span></a>.</p> <p>Here’s an example with a test database configuration:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">DATABASES</span> <span class="o">=</span> <span class="p">{</span> <span class="s1">'default'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'ENGINE'</span><span class="p">:</span> <span class="s1">'django.db.backends.postgresql'</span><span class="p">,</span> <span class="s1">'USER'</span><span class="p">:</span> <span class="s1">'mydatabaseuser'</span><span class="p">,</span> <span class="s1">'NAME'</span><span class="p">:</span> <span class="s1">'mydatabase'</span><span class="p">,</span> <span class="s1">'TEST'</span><span class="p">:</span> <span class="p">{</span> <span class="s1">'NAME'</span><span class="p">:</span> <span class="s1">'mytestdatabase'</span><span class="p">,</span> <span class="p">},</span> <span class="p">},</span> <span class="p">}</span> </pre></div> </div> <p>The following keys in the <code class="docutils literal notranslate"><span class="pre">TEST</span></code> dictionary are available:</p> <div class="section" id="s-charset"> <span id="s-std:setting-TEST_CHARSET"></span><span id="charset"></span><span id="std:setting-TEST_CHARSET"></span><h5><code class="docutils literal notranslate"><span class="pre">CHARSET</span></code><a class="headerlink" href="#charset" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The character set encoding used to create the test database. The value of this string is passed directly through to the database, so its format is backend-specific.</p> <p>Supported by the <a class="reference external" href="https://www.postgresql.org/docs/current/multibyte.html">PostgreSQL</a> (<code class="docutils literal notranslate"><span class="pre">postgresql</span></code>) and <a class="reference external" href="https://dev.mysql.com/doc/refman/en/charset-charsets.html">MySQL</a> (<code class="docutils literal notranslate"><span class="pre">mysql</span></code>) backends.</p> </div> <div class="section" id="s-collation"> <span id="s-std:setting-TEST_COLLATION"></span><span id="collation"></span><span id="std:setting-TEST_COLLATION"></span><h5><code class="docutils literal notranslate"><span class="pre">COLLATION</span></code><a class="headerlink" href="#collation" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The collation order to use when creating the test database. This value is passed directly to the backend, so its format is backend-specific.</p> <p>Only supported for the <code class="docutils literal notranslate"><span class="pre">mysql</span></code> backend (see the <a class="reference external" href="https://dev.mysql.com/doc/refman/en/charset-charsets.html">MySQL manual</a> for details).</p> </div> <div class="section" id="s-dependencies"> <span id="s-std:setting-TEST_DEPENDENCIES"></span><span id="dependencies"></span><span id="std:setting-TEST_DEPENDENCIES"></span><h5><code class="docutils literal notranslate"><span class="pre">DEPENDENCIES</span></code><a class="headerlink" href="#dependencies" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">['default']</span></code>, for all databases other than <code class="docutils literal notranslate"><span class="pre">default</span></code>, which has no dependencies.</p> <p>The creation-order dependencies of the database. See the documentation on <a class="reference internal" href="../../topics/testing/advanced/#topics-testing-creation-dependencies"><span class="std std-ref">controlling the creation order of test databases</span></a> for details.</p> </div> <div class="section" id="s-mirror"> <span id="s-std:setting-TEST_MIRROR"></span><span id="mirror"></span><span id="std:setting-TEST_MIRROR"></span><h5><code class="docutils literal notranslate"><span class="pre">MIRROR</span></code><a class="headerlink" href="#mirror" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The alias of the database that this database should mirror during testing.</p> <p>This setting exists to allow for testing of primary/replica (referred to as master/slave by some databases) configurations of multiple databases. See the documentation on <a class="reference internal" href="../../topics/testing/advanced/#topics-testing-primaryreplica"><span class="std std-ref">testing primary/replica configurations</span></a> for details.</p> </div> <div class="section" id="s-std:setting-TEST_NAME"> <span id="s-id2"></span><span id="std:setting-TEST_NAME"></span><span id="id2"></span><h5><code class="docutils literal notranslate"><span class="pre">NAME</span></code><a class="headerlink" href="#std:setting-TEST_NAME" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The name of database to use when running the test suite.</p> <p>If the default value (<code class="docutils literal notranslate"><span class="pre">None</span></code>) is used with the SQLite database engine, the tests will use a memory resident database. For all other database engines the test database will use the name <code class="docutils literal notranslate"><span class="pre">'test_'</span> <span class="pre">+</span> <span class="pre">DATABASE_NAME</span></code>.</p> <p>See <a class="reference internal" href="../../topics/testing/overview/#the-test-database"><span class="std std-ref">The test database</span></a>.</p> </div> <div class="section" id="s-serialize"> <span id="s-std:setting-TEST_SERIALIZE"></span><span id="serialize"></span><span id="std:setting-TEST_SERIALIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">SERIALIZE</span></code><a class="headerlink" href="#serialize" title="Permalink to this headline">¶</a></h5> <p>Boolean value to control whether or not the default test runner serializes the database into an in-memory JSON string before running tests (used to restore the database state between tests if you don’t have transactions). You can set this to <code class="docutils literal notranslate"><span class="pre">False</span></code> to speed up creation time if you don’t have any test classes with <a class="reference internal" href="../../topics/testing/overview/#test-case-serialized-rollback"><span class="std std-ref">serialized_rollback=True</span></a>.</p> </div> <div class="section" id="s-template"> <span id="s-std:setting-TEST_TEMPLATE"></span><span id="template"></span><span id="std:setting-TEST_TEMPLATE"></span><h5><code class="docutils literal notranslate"><span class="pre">TEMPLATE</span></code><a class="headerlink" href="#template" title="Permalink to this headline">¶</a></h5> <p>This is a PostgreSQL-specific setting.</p> <p>The name of a <a class="reference external" href="https://www.postgresql.org/docs/current/sql-createdatabase.html">template</a> (e.g. <code class="docutils literal notranslate"><span class="pre">'template0'</span></code>) from which to create the test database.</p> </div> <div class="section" id="s-create-db"> <span id="s-std:setting-TEST_CREATE"></span><span id="create-db"></span><span id="std:setting-TEST_CREATE"></span><h5><code class="docutils literal notranslate"><span class="pre">CREATE_DB</span></code><a class="headerlink" href="#create-db" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>This is an Oracle-specific setting.</p> <p>If it is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>, the test tablespaces won’t be automatically created at the beginning of the tests or dropped at the end.</p> </div> <div class="section" id="s-create-user"> <span id="s-std:setting-TEST_USER_CREATE"></span><span id="create-user"></span><span id="std:setting-TEST_USER_CREATE"></span><h5><code class="docutils literal notranslate"><span class="pre">CREATE_USER</span></code><a class="headerlink" href="#create-user" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>This is an Oracle-specific setting.</p> <p>If it is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>, the test user won’t be automatically created at the beginning of the tests and dropped at the end.</p> </div> <div class="section" id="s-std:setting-TEST_USER"> <span id="s-id4"></span><span id="std:setting-TEST_USER"></span><span id="id4"></span><h5><code class="docutils literal notranslate"><span class="pre">USER</span></code><a class="headerlink" href="#std:setting-TEST_USER" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The username to use when connecting to the Oracle database that will be used when running tests. If not provided, Django will use <code class="docutils literal notranslate"><span class="pre">'test_'</span> <span class="pre">+</span> <span class="pre">USER</span></code>.</p> </div> <div class="section" id="s-std:setting-TEST_PASSWD"> <span id="s-id5"></span><span id="std:setting-TEST_PASSWD"></span><span id="id5"></span><h5><code class="docutils literal notranslate"><span class="pre">PASSWORD</span></code><a class="headerlink" href="#std:setting-TEST_PASSWD" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The password to use when connecting to the Oracle database that will be used when running tests. If not provided, Django will generate a random password.</p> </div> <div class="section" id="s-oracle-managed-files"> <span id="s-std:setting-TEST_ORACLE_MANAGED_FILES"></span><span id="oracle-managed-files"></span><span id="std:setting-TEST_ORACLE_MANAGED_FILES"></span><h5><code class="docutils literal notranslate"><span class="pre">ORACLE_MANAGED_FILES</span></code><a class="headerlink" href="#oracle-managed-files" title="Permalink to this headline">¶</a></h5> <div class="versionadded"> <span class="title">New in Django 2.2.</span> </div> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>This is an Oracle-specific setting.</p> <p>If set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, Oracle Managed Files (OMF) tablespaces will be used. <a class="reference internal" href="#std:setting-DATAFILE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATAFILE</span></code></a> and <a class="reference internal" href="#std:setting-DATAFILE_TMP"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATAFILE_TMP</span></code></a> will be ignored.</p> </div> <div class="section" id="s-tblspace"> <span id="s-std:setting-TEST_TBLSPACE"></span><span id="tblspace"></span><span id="std:setting-TEST_TBLSPACE"></span><h5><code class="docutils literal notranslate"><span class="pre">TBLSPACE</span></code><a class="headerlink" href="#tblspace" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The name of the tablespace that will be used when running tests. If not provided, Django will use <code class="docutils literal notranslate"><span class="pre">'test_'</span> <span class="pre">+</span> <span class="pre">USER</span></code>.</p> </div> <div class="section" id="s-tblspace-tmp"> <span id="s-std:setting-TEST_TBLSPACE_TMP"></span><span id="tblspace-tmp"></span><span id="std:setting-TEST_TBLSPACE_TMP"></span><h5><code class="docutils literal notranslate"><span class="pre">TBLSPACE_TMP</span></code><a class="headerlink" href="#tblspace-tmp" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The name of the temporary tablespace that will be used when running tests. If not provided, Django will use <code class="docutils literal notranslate"><span class="pre">'test_'</span> <span class="pre">+</span> <span class="pre">USER</span> <span class="pre">+</span> <span class="pre">'_temp'</span></code>.</p> </div> <div class="section" id="s-datafile"> <span id="s-std:setting-DATAFILE"></span><span id="datafile"></span><span id="std:setting-DATAFILE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE</span></code><a class="headerlink" href="#datafile" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The name of the datafile to use for the TBLSPACE. If not provided, Django will use <code class="docutils literal notranslate"><span class="pre">TBLSPACE</span> <span class="pre">+</span> <span class="pre">'.dbf'</span></code>.</p> </div> <div class="section" id="s-datafile-tmp"> <span id="s-std:setting-DATAFILE_TMP"></span><span id="datafile-tmp"></span><span id="std:setting-DATAFILE_TMP"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP</span></code><a class="headerlink" href="#datafile-tmp" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The name of the datafile to use for the TBLSPACE_TMP. If not provided, Django will use <code class="docutils literal notranslate"><span class="pre">TBLSPACE_TMP</span> <span class="pre">+</span> <span class="pre">'.dbf'</span></code>.</p> </div> <div class="section" id="s-datafile-maxsize"> <span id="s-std:setting-DATAFILE_MAXSIZE"></span><span id="datafile-maxsize"></span><span id="std:setting-DATAFILE_MAXSIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_MAXSIZE</span></code><a class="headerlink" href="#datafile-maxsize" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'500M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The maximum size that the DATAFILE is allowed to grow to.</p> </div> <div class="section" id="s-datafile-tmp-maxsize"> <span id="s-std:setting-DATAFILE_TMP_MAXSIZE"></span><span id="datafile-tmp-maxsize"></span><span id="std:setting-DATAFILE_TMP_MAXSIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_MAXSIZE</span></code><a class="headerlink" href="#datafile-tmp-maxsize" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'500M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The maximum size that the DATAFILE_TMP is allowed to grow to.</p> </div> <div class="section" id="s-datafile-size"> <span id="s-std:setting-DATAFILE_SIZE"></span><span id="datafile-size"></span><span id="std:setting-DATAFILE_SIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_SIZE</span></code><a class="headerlink" href="#datafile-size" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'50M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The initial size of the DATAFILE.</p> </div> <div class="section" id="s-datafile-tmp-size"> <span id="s-std:setting-DATAFILE_TMP_SIZE"></span><span id="datafile-tmp-size"></span><span id="std:setting-DATAFILE_TMP_SIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_SIZE</span></code><a class="headerlink" href="#datafile-tmp-size" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'50M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The initial size of the DATAFILE_TMP.</p> </div> <div class="section" id="s-datafile-extsize"> <span id="s-std:setting-DATAFILE_EXTSIZE"></span><span id="datafile-extsize"></span><span id="std:setting-DATAFILE_EXTSIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_EXTSIZE</span></code><a class="headerlink" href="#datafile-extsize" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'25M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The amount by which the DATAFILE is extended when more space is required.</p> </div> <div class="section" id="s-datafile-tmp-extsize"> <span id="s-std:setting-DATAFILE_TMP_EXTSIZE"></span><span id="datafile-tmp-extsize"></span><span id="std:setting-DATAFILE_TMP_EXTSIZE"></span><h5><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_EXTSIZE</span></code><a class="headerlink" href="#datafile-tmp-extsize" title="Permalink to this headline">¶</a></h5> <p>Default: <code class="docutils literal notranslate"><span class="pre">'25M'</span></code></p> <p>This is an Oracle-specific setting.</p> <p>The amount by which the DATAFILE_TMP is extended when more space is required.</p> </div> </div> </div> <div class="section" id="s-data-upload-max-memory-size"> <span id="s-std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE"></span><span id="data-upload-max-memory-size"></span><span id="std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE"></span><h3>DATA_UPLOAD_MAX_MEMORY_SIZE<a class="headerlink" href="#data-upload-max-memory-size" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">2621440</span></code> (i.e. 2.5 MB).</p> <p>The maximum size in bytes that a request body may be before a <a class="reference internal" href="../exceptions/#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SuspiciousOperation</span></code></a> (<code class="docutils literal notranslate"><span class="pre">RequestDataTooBig</span></code>) is raised. The check is done when accessing <code class="docutils literal notranslate"><span class="pre">request.body</span></code> or <code class="docutils literal notranslate"><span class="pre">request.POST</span></code> and is calculated against the total request size excluding any file upload data. You can set this to <code class="docutils literal notranslate"><span class="pre">None</span></code> to disable the check. Applications that are expected to receive unusually large form posts should tune this setting.</p> <p>The amount of request data is correlated to the amount of memory needed to process the request and populate the GET and POST dictionaries. Large requests could be used as a denial-of-service attack vector if left unchecked. Since web servers don’t typically perform deep request inspection, it’s not possible to perform a similar check at that level.</p> <p>See also <a class="reference internal" href="#std:setting-FILE_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_MAX_MEMORY_SIZE</span></code></a>.</p> </div> <div class="section" id="s-data-upload-max-number-fields"> <span id="s-std:setting-DATA_UPLOAD_MAX_NUMBER_FIELDS"></span><span id="data-upload-max-number-fields"></span><span id="std:setting-DATA_UPLOAD_MAX_NUMBER_FIELDS"></span><h3>DATA_UPLOAD_MAX_NUMBER_FIELDS<a class="headerlink" href="#data-upload-max-number-fields" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">1000</span></code></p> <p>The maximum number of parameters that may be received via GET or POST before a <a class="reference internal" href="../exceptions/#django.core.exceptions.SuspiciousOperation" title="django.core.exceptions.SuspiciousOperation"><code class="xref py py-exc docutils literal notranslate"><span class="pre">SuspiciousOperation</span></code></a> (<code class="docutils literal notranslate"><span class="pre">TooManyFields</span></code>) is raised. You can set this to <code class="docutils literal notranslate"><span class="pre">None</span></code> to disable the check. Applications that are expected to receive an unusually large number of form fields should tune this setting.</p> <p>The number of request parameters is correlated to the amount of time needed to process the request and populate the GET and POST dictionaries. Large requests could be used as a denial-of-service attack vector if left unchecked. Since web servers don’t typically perform deep request inspection, it’s not possible to perform a similar check at that level.</p> </div> <div class="section" id="s-database-routers"> <span id="s-std:setting-DATABASE_ROUTERS"></span><span id="database-routers"></span><span id="std:setting-DATABASE_ROUTERS"></span><h3><code class="docutils literal notranslate"><span class="pre">DATABASE_ROUTERS</span></code><a class="headerlink" href="#database-routers" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>The list of routers that will be used to determine which database to use when performing a database query.</p> <p>See the documentation on <a class="reference internal" href="../../topics/db/multi-db/#topics-db-multi-db-routing"><span class="std std-ref">automatic database routing in multi database configurations</span></a>.</p> </div> <div class="section" id="s-date-format"> <span id="s-std:setting-DATE_FORMAT"></span><span id="date-format"></span><span id="std:setting-DATE_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code><a class="headerlink" href="#date-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'N</span> <span class="pre">j,</span> <span class="pre">Y'</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">Feb.</span> <span class="pre">4,</span> <span class="pre">2003</span></code>)</p> <p>The default formatting to use for displaying date fields in any part of the system. Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead. See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>.</p> <p>See also <a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-date-input-formats"> <span id="s-std:setting-DATE_INPUT_FORMATS"></span><span id="date-input-formats"></span><span id="std:setting-DATE_INPUT_FORMATS"></span><h3><code class="docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code><a class="headerlink" href="#date-input-formats" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'%Y-%m-</span><span class="si">%d</span><span class="s1">'</span><span class="p">,</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%Y'</span><span class="p">,</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%y'</span><span class="p">,</span> <span class="c1"># '2006-10-25', '10/25/2006', '10/25/06'</span> <span class="s1">'%b </span><span class="si">%d</span><span class="s1"> %Y'</span><span class="p">,</span> <span class="s1">'%b </span><span class="si">%d</span><span class="s1">, %Y'</span><span class="p">,</span> <span class="c1"># 'Oct 25 2006', 'Oct 25, 2006'</span> <span class="s1">'</span><span class="si">%d</span><span class="s1"> %b %Y'</span><span class="p">,</span> <span class="s1">'</span><span class="si">%d</span><span class="s1"> %b, %Y'</span><span class="p">,</span> <span class="c1"># '25 Oct 2006', '25 Oct, 2006'</span> <span class="s1">'%B </span><span class="si">%d</span><span class="s1"> %Y'</span><span class="p">,</span> <span class="s1">'%B </span><span class="si">%d</span><span class="s1">, %Y'</span><span class="p">,</span> <span class="c1"># 'October 25 2006', 'October 25, 2006'</span> <span class="s1">'</span><span class="si">%d</span><span class="s1"> %B %Y'</span><span class="p">,</span> <span class="s1">'</span><span class="si">%d</span><span class="s1"> %B, %Y'</span><span class="p">,</span> <span class="c1"># '25 October 2006', '25 October, 2006'</span> <span class="p">]</span> </pre></div> </div> <p>A list of formats that will be accepted when inputting data on a date field. Formats will be tried in order, using the first valid one. Note that these format strings use Python’s <a class="reference external" href="https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior" title="(in Python v3.9)"><span class="xref std std-ref">datetime module syntax</span></a>, not the format strings from the <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> template filter.</p> <p>When <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-DATETIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code></a> and <a class="reference internal" href="#std:setting-TIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code></a>.</p> </div> <div class="section" id="s-datetime-format"> <span id="s-std:setting-DATETIME_FORMAT"></span><span id="datetime-format"></span><span id="std:setting-DATETIME_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code><a class="headerlink" href="#datetime-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'N</span> <span class="pre">j,</span> <span class="pre">Y,</span> <span class="pre">P'</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">Feb.</span> <span class="pre">4,</span> <span class="pre">2003,</span> <span class="pre">4</span> <span class="pre">p.m.</span></code>)</p> <p>The default formatting to use for displaying datetime fields in any part of the system. Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead. See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-datetime-input-formats"> <span id="s-std:setting-DATETIME_INPUT_FORMATS"></span><span id="datetime-input-formats"></span><span id="std:setting-DATETIME_INPUT_FORMATS"></span><h3><code class="docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code><a class="headerlink" href="#datetime-input-formats" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'%Y-%m-</span><span class="si">%d</span><span class="s1"> %H:%M:%S'</span><span class="p">,</span> <span class="c1"># '2006-10-25 14:30:59'</span> <span class="s1">'%Y-%m-</span><span class="si">%d</span><span class="s1"> %H:%M:%S.</span><span class="si">%f</span><span class="s1">'</span><span class="p">,</span> <span class="c1"># '2006-10-25 14:30:59.000200'</span> <span class="s1">'%Y-%m-</span><span class="si">%d</span><span class="s1"> %H:%M'</span><span class="p">,</span> <span class="c1"># '2006-10-25 14:30'</span> <span class="s1">'%Y-%m-</span><span class="si">%d</span><span class="s1">'</span><span class="p">,</span> <span class="c1"># '2006-10-25'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%Y %H:%M:%S'</span><span class="p">,</span> <span class="c1"># '10/25/2006 14:30:59'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%Y %H:%M:%S.</span><span class="si">%f</span><span class="s1">'</span><span class="p">,</span> <span class="c1"># '10/25/2006 14:30:59.000200'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%Y %H:%M'</span><span class="p">,</span> <span class="c1"># '10/25/2006 14:30'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%Y'</span><span class="p">,</span> <span class="c1"># '10/25/2006'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%y %H:%M:%S'</span><span class="p">,</span> <span class="c1"># '10/25/06 14:30:59'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%y %H:%M:%S.</span><span class="si">%f</span><span class="s1">'</span><span class="p">,</span> <span class="c1"># '10/25/06 14:30:59.000200'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%y %H:%M'</span><span class="p">,</span> <span class="c1"># '10/25/06 14:30'</span> <span class="s1">'%m/</span><span class="si">%d</span><span class="s1">/%y'</span><span class="p">,</span> <span class="c1"># '10/25/06'</span> <span class="p">]</span> </pre></div> </div> <p>A list of formats that will be accepted when inputting data on a datetime field. Formats will be tried in order, using the first valid one. Note that these format strings use Python’s <a class="reference external" href="https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior" title="(in Python v3.9)"><span class="xref std std-ref">datetime module syntax</span></a>, not the format strings from the <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> template filter.</p> <p>When <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code></a> and <a class="reference internal" href="#std:setting-TIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code></a>.</p> </div> <div class="section" id="s-debug"> <span id="s-std:setting-DEBUG"></span><span id="debug"></span><span id="std:setting-DEBUG"></span><h3><code class="docutils literal notranslate"><span class="pre">DEBUG</span></code><a class="headerlink" href="#debug" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that turns on/off debug mode.</p> <p>Never deploy a site into production with <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> turned on.</p> <p>One of the main features of debug mode is the display of detailed error pages. If your app raises an exception when <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, Django will display a detailed traceback, including a lot of metadata about your environment, such as all the currently defined Django settings (from <code class="docutils literal notranslate"><span class="pre">settings.py</span></code>).</p> <p>As a security measure, Django will <em>not</em> include settings that might be sensitive, such as <a class="reference internal" href="#std:setting-SECRET_KEY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a>. Specifically, it will exclude any setting whose name includes any of the following:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'API'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'KEY'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'PASS'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'SECRET'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'SIGNATURE'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'TOKEN'</span></code></li> </ul> <p>Note that these are <em>partial</em> matches. <code class="docutils literal notranslate"><span class="pre">'PASS'</span></code> will also match PASSWORD, just as <code class="docutils literal notranslate"><span class="pre">'TOKEN'</span></code> will also match TOKENIZED and so on.</p> <p>Still, note that there are always going to be sections of your debug output that are inappropriate for public consumption. File paths, configuration options and the like all give attackers extra information about your server.</p> <p>It is also important to remember that when running with <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> turned on, Django will remember every SQL query it executes. This is useful when you’re debugging, but it’ll rapidly consume memory on a production server.</p> <p>Finally, if <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, you also need to properly set the <a class="reference internal" href="#std:setting-ALLOWED_HOSTS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ALLOWED_HOSTS</span></code></a> setting. Failing to do so will result in all requests being returned as “Bad Request (400)”.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> sets <code class="docutils literal notranslate"><span class="pre">DEBUG</span> <span class="pre">=</span> <span class="pre">True</span></code> for convenience.</p> </div> </div> <div class="section" id="s-debug-propagate-exceptions"> <span id="s-std:setting-DEBUG_PROPAGATE_EXCEPTIONS"></span><span id="debug-propagate-exceptions"></span><span id="std:setting-DEBUG_PROPAGATE_EXCEPTIONS"></span><h3><code class="docutils literal notranslate"><span class="pre">DEBUG_PROPAGATE_EXCEPTIONS</span></code><a class="headerlink" href="#debug-propagate-exceptions" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>If set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, Django’s exception handling of view functions (<a class="reference internal" href="../urls/#django.conf.urls.handler500" title="django.conf.urls.handler500"><code class="xref py py-data docutils literal notranslate"><span class="pre">handler500</span></code></a>, or the debug view if <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>) and logging of 500 responses (<a class="reference internal" href="../../topics/logging/#django-request-logger"><span class="std std-ref">django.request</span></a>) is skipped and exceptions propagate upwards.</p> <p>This can be useful for some test setups. It shouldn’t be used on a live site unless you want your web server (instead of Django) to generate “Internal Server Error” responses. In that case, make sure your server doesn’t show the stack trace or other sensitive information in the response.</p> </div> <div class="section" id="s-decimal-separator"> <span id="s-std:setting-DECIMAL_SEPARATOR"></span><span id="decimal-separator"></span><span id="std:setting-DECIMAL_SEPARATOR"></span><h3><code class="docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code><a class="headerlink" href="#decimal-separator" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'.'</span></code> (Dot)</p> <p>Default decimal separator used when formatting decimal numbers.</p> <p>Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a>, <a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a> and <a class="reference internal" href="#std:setting-USE_THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a>.</p> </div> <div class="section" id="s-default-charset"> <span id="s-std:setting-DEFAULT_CHARSET"></span><span id="default-charset"></span><span id="std:setting-DEFAULT_CHARSET"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_CHARSET</span></code><a class="headerlink" href="#default-charset" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code></p> <p>Default charset to use for all <code class="docutils literal notranslate"><span class="pre">HttpResponse</span></code> objects, if a MIME type isn’t manually specified. Used when constructing the <code class="docutils literal notranslate"><span class="pre">Content-Type</span></code> header.</p> </div> <div class="section" id="s-default-exception-reporter-filter"> <span id="s-std:setting-DEFAULT_EXCEPTION_REPORTER_FILTER"></span><span id="default-exception-reporter-filter"></span><span id="std:setting-DEFAULT_EXCEPTION_REPORTER_FILTER"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_EXCEPTION_REPORTER_FILTER</span></code><a class="headerlink" href="#default-exception-reporter-filter" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'</span></code><a class="reference internal" href="../../howto/error-reporting/#django.views.debug.SafeExceptionReporterFilter" title="django.views.debug.SafeExceptionReporterFilter"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.views.debug.SafeExceptionReporterFilter</span></code></a><code class="docutils literal notranslate"><span class="pre">'</span></code></p> <p>Default exception reporter filter class to be used if none has been assigned to the <a class="reference internal" href="../request-response/#django.http.HttpRequest" title="django.http.HttpRequest"><code class="xref py py-class docutils literal notranslate"><span class="pre">HttpRequest</span></code></a> instance yet. See <a class="reference internal" href="../../howto/error-reporting/#filtering-error-reports"><span class="std std-ref">Filtering error reports</span></a>.</p> </div> <div class="section" id="s-default-file-storage"> <span id="s-std:setting-DEFAULT_FILE_STORAGE"></span><span id="default-file-storage"></span><span id="std:setting-DEFAULT_FILE_STORAGE"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_FILE_STORAGE</span></code><a class="headerlink" href="#default-file-storage" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'</span></code><a class="reference internal" href="../files/storage/#django.core.files.storage.FileSystemStorage" title="django.core.files.storage.FileSystemStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.core.files.storage.FileSystemStorage</span></code></a><code class="docutils literal notranslate"><span class="pre">'</span></code></p> <p>Default file storage class to be used for any file-related operations that don’t specify a particular storage system. See <a class="reference internal" href="../../topics/files/"><span class="doc">Managing files</span></a>.</p> </div> <div class="section" id="s-default-from-email"> <span id="s-std:setting-DEFAULT_FROM_EMAIL"></span><span id="default-from-email"></span><span id="std:setting-DEFAULT_FROM_EMAIL"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_FROM_EMAIL</span></code><a class="headerlink" href="#default-from-email" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'webmaster@localhost'</span></code></p> <p>Default email address to use for various automated correspondence from the site manager(s). This doesn’t include error messages sent to <a class="reference internal" href="#std:setting-ADMINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ADMINS</span></code></a> and <a class="reference internal" href="#std:setting-MANAGERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MANAGERS</span></code></a>; for that, see <a class="reference internal" href="#std:setting-SERVER_EMAIL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SERVER_EMAIL</span></code></a>.</p> </div> <div class="section" id="s-default-index-tablespace"> <span id="s-std:setting-DEFAULT_INDEX_TABLESPACE"></span><span id="default-index-tablespace"></span><span id="std:setting-DEFAULT_INDEX_TABLESPACE"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_INDEX_TABLESPACE</span></code><a class="headerlink" href="#default-index-tablespace" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Default tablespace to use for indexes on fields that don’t specify one, if the backend supports it (see <a class="reference internal" href="../../topics/db/tablespaces/"><span class="doc">Tablespaces</span></a>).</p> </div> <div class="section" id="s-default-tablespace"> <span id="s-std:setting-DEFAULT_TABLESPACE"></span><span id="default-tablespace"></span><span id="std:setting-DEFAULT_TABLESPACE"></span><h3><code class="docutils literal notranslate"><span class="pre">DEFAULT_TABLESPACE</span></code><a class="headerlink" href="#default-tablespace" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Default tablespace to use for models that don’t specify one, if the backend supports it (see <a class="reference internal" href="../../topics/db/tablespaces/"><span class="doc">Tablespaces</span></a>).</p> </div> <div class="section" id="s-disallowed-user-agents"> <span id="s-std:setting-DISALLOWED_USER_AGENTS"></span><span id="disallowed-user-agents"></span><span id="std:setting-DISALLOWED_USER_AGENTS"></span><h3><code class="docutils literal notranslate"><span class="pre">DISALLOWED_USER_AGENTS</span></code><a class="headerlink" href="#disallowed-user-agents" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>List of compiled regular expression objects representing User-Agent strings that are not allowed to visit any page, systemwide. Use this for bots/crawlers. This is only used if <code class="docutils literal notranslate"><span class="pre">CommonMiddleware</span></code> is installed (see <a class="reference internal" href="../../topics/http/middleware/"><span class="doc">Middleware</span></a>).</p> </div> <div class="section" id="s-email-backend"> <span id="s-std:setting-EMAIL_BACKEND"></span><span id="email-backend"></span><span id="std:setting-EMAIL_BACKEND"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_BACKEND</span></code><a class="headerlink" href="#email-backend" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'</span></code><a class="reference internal" href="../../topics/email/#django.core.mail.backends.smtp.EmailBackend" title="django.core.mail.backends.smtp.EmailBackend"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.core.mail.backends.smtp.EmailBackend</span></code></a><code class="docutils literal notranslate"><span class="pre">'</span></code></p> <p>The backend to use for sending emails. For the list of available backends see <a class="reference internal" href="../../topics/email/"><span class="doc">Sending email</span></a>.</p> </div> <div class="section" id="s-email-file-path"> <span id="s-std:setting-EMAIL_FILE_PATH"></span><span id="email-file-path"></span><span id="std:setting-EMAIL_FILE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_FILE_PATH</span></code><a class="headerlink" href="#email-file-path" title="Permalink to this headline">¶</a></h3> <p>Default: Not defined</p> <p>The directory used by the <a class="reference internal" href="../../topics/email/#topic-email-file-backend"><span class="std std-ref">file email backend</span></a> to store output files.</p> </div> <div class="section" id="s-email-host"> <span id="s-std:setting-EMAIL_HOST"></span><span id="email-host"></span><span id="std:setting-EMAIL_HOST"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code><a class="headerlink" href="#email-host" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'localhost'</span></code></p> <p>The host to use for sending email.</p> <p>See also <a class="reference internal" href="#std:setting-EMAIL_PORT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_PORT</span></code></a>.</p> </div> <div class="section" id="s-email-host-password"> <span id="s-std:setting-EMAIL_HOST_PASSWORD"></span><span id="email-host-password"></span><span id="std:setting-EMAIL_HOST_PASSWORD"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST_PASSWORD</span></code><a class="headerlink" href="#email-host-password" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Password to use for the SMTP server defined in <a class="reference internal" href="#std:setting-EMAIL_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code></a>. This setting is used in conjunction with <a class="reference internal" href="#std:setting-EMAIL_HOST_USER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST_USER</span></code></a> when authenticating to the SMTP server. If either of these settings is empty, Django won’t attempt authentication.</p> <p>See also <a class="reference internal" href="#std:setting-EMAIL_HOST_USER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST_USER</span></code></a>.</p> </div> <div class="section" id="s-email-host-user"> <span id="s-std:setting-EMAIL_HOST_USER"></span><span id="email-host-user"></span><span id="std:setting-EMAIL_HOST_USER"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST_USER</span></code><a class="headerlink" href="#email-host-user" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Username to use for the SMTP server defined in <a class="reference internal" href="#std:setting-EMAIL_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code></a>. If empty, Django won’t attempt authentication.</p> <p>See also <a class="reference internal" href="#std:setting-EMAIL_HOST_PASSWORD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST_PASSWORD</span></code></a>.</p> </div> <div class="section" id="s-email-port"> <span id="s-std:setting-EMAIL_PORT"></span><span id="email-port"></span><span id="std:setting-EMAIL_PORT"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_PORT</span></code><a class="headerlink" href="#email-port" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">25</span></code></p> <p>Port to use for the SMTP server defined in <a class="reference internal" href="#std:setting-EMAIL_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code></a>.</p> </div> <div class="section" id="s-email-subject-prefix"> <span id="s-std:setting-EMAIL_SUBJECT_PREFIX"></span><span id="email-subject-prefix"></span><span id="std:setting-EMAIL_SUBJECT_PREFIX"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_SUBJECT_PREFIX</span></code><a class="headerlink" href="#email-subject-prefix" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'[Django]</span> <span class="pre">'</span></code></p> <p>Subject-line prefix for email messages sent with <code class="docutils literal notranslate"><span class="pre">django.core.mail.mail_admins</span></code> or <code class="docutils literal notranslate"><span class="pre">django.core.mail.mail_managers</span></code>. You’ll probably want to include the trailing space.</p> </div> <div class="section" id="s-email-use-localtime"> <span id="s-std:setting-EMAIL_USE_LOCALTIME"></span><span id="email-use-localtime"></span><span id="std:setting-EMAIL_USE_LOCALTIME"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_LOCALTIME</span></code><a class="headerlink" href="#email-use-localtime" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to send the SMTP <code class="docutils literal notranslate"><span class="pre">Date</span></code> header of email messages in the local time zone (<code class="docutils literal notranslate"><span class="pre">True</span></code>) or in UTC (<code class="docutils literal notranslate"><span class="pre">False</span></code>).</p> </div> <div class="section" id="s-email-use-tls"> <span id="s-std:setting-EMAIL_USE_TLS"></span><span id="email-use-tls"></span><span id="std:setting-EMAIL_USE_TLS"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code><a class="headerlink" href="#email-use-tls" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use a TLS (secure) connection when talking to the SMTP server. This is used for explicit TLS connections, generally on port 587. If you are experiencing hanging connections, see the implicit TLS setting <a class="reference internal" href="#std:setting-EMAIL_USE_SSL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code></a>.</p> </div> <div class="section" id="s-email-use-ssl"> <span id="s-std:setting-EMAIL_USE_SSL"></span><span id="email-use-ssl"></span><span id="std:setting-EMAIL_USE_SSL"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code><a class="headerlink" href="#email-use-ssl" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use an implicit TLS (secure) connection when talking to the SMTP server. In most email documentation this type of TLS connection is referred to as SSL. It is generally used on port 465. If you are experiencing problems, see the explicit TLS setting <a class="reference internal" href="#std:setting-EMAIL_USE_TLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a>.</p> <p>Note that <a class="reference internal" href="#std:setting-EMAIL_USE_TLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a>/<a class="reference internal" href="#std:setting-EMAIL_USE_SSL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code></a> are mutually exclusive, so only set one of those settings to <code class="docutils literal notranslate"><span class="pre">True</span></code>.</p> </div> <div class="section" id="s-email-ssl-certfile"> <span id="s-std:setting-EMAIL_SSL_CERTFILE"></span><span id="email-ssl-certfile"></span><span id="std:setting-EMAIL_SSL_CERTFILE"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_SSL_CERTFILE</span></code><a class="headerlink" href="#email-ssl-certfile" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If <a class="reference internal" href="#std:setting-EMAIL_USE_SSL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code></a> or <a class="reference internal" href="#std:setting-EMAIL_USE_TLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, you can optionally specify the path to a PEM-formatted certificate chain file to use for the SSL connection.</p> </div> <div class="section" id="s-email-ssl-keyfile"> <span id="s-std:setting-EMAIL_SSL_KEYFILE"></span><span id="email-ssl-keyfile"></span><span id="std:setting-EMAIL_SSL_KEYFILE"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_SSL_KEYFILE</span></code><a class="headerlink" href="#email-ssl-keyfile" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If <a class="reference internal" href="#std:setting-EMAIL_USE_SSL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code></a> or <a class="reference internal" href="#std:setting-EMAIL_USE_TLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, you can optionally specify the path to a PEM-formatted private key file to use for the SSL connection.</p> <p>Note that setting <a class="reference internal" href="#std:setting-EMAIL_SSL_CERTFILE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_SSL_CERTFILE</span></code></a> and <a class="reference internal" href="#std:setting-EMAIL_SSL_KEYFILE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_SSL_KEYFILE</span></code></a> doesn’t result in any certificate checking. They’re passed to the underlying SSL connection. Please refer to the documentation of Python’s <a class="reference external" href="https://docs.python.org/3/library/ssl.html#ssl.wrap_socket" title="(in Python v3.9)"><code class="docutils literal notranslate"><span class="pre">ssl.wrap_socket()</span></code></a> function for details on how the certificate chain file and private key file are handled.</p> </div> <div class="section" id="s-email-timeout"> <span id="s-std:setting-EMAIL_TIMEOUT"></span><span id="email-timeout"></span><span id="std:setting-EMAIL_TIMEOUT"></span><h3><code class="docutils literal notranslate"><span class="pre">EMAIL_TIMEOUT</span></code><a class="headerlink" href="#email-timeout" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>Specifies a timeout in seconds for blocking operations like the connection attempt.</p> </div> <div class="section" id="s-file-charset"> <span id="s-std:setting-FILE_CHARSET"></span><span id="file-charset"></span><span id="std:setting-FILE_CHARSET"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_CHARSET</span></code><a class="headerlink" href="#file-charset" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'utf-8'</span></code></p> <p>The character encoding used to decode any files read from disk. This includes template files, static files, and translation catalogs.</p> <div class="deprecated"> <p><span class="versionmodified">Deprecated since version 2.2: </span>This setting is deprecated. Starting with Django 3.1, files read from disk must be UTF-8 encoded.</p> </div> </div> <div class="section" id="s-file-upload-handlers"> <span id="s-std:setting-FILE_UPLOAD_HANDLERS"></span><span id="file-upload-handlers"></span><span id="std:setting-FILE_UPLOAD_HANDLERS"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_HANDLERS</span></code><a class="headerlink" href="#file-upload-handlers" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'django.core.files.uploadhandler.MemoryFileUploadHandler'</span><span class="p">,</span> <span class="s1">'django.core.files.uploadhandler.TemporaryFileUploadHandler'</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> <p>A list of handlers to use for uploading. Changing this setting allows complete customization – even replacement – of Django’s upload process.</p> <p>See <a class="reference internal" href="../../topics/files/"><span class="doc">Managing files</span></a> for details.</p> </div> <div class="section" id="s-file-upload-max-memory-size"> <span id="s-std:setting-FILE_UPLOAD_MAX_MEMORY_SIZE"></span><span id="file-upload-max-memory-size"></span><span id="std:setting-FILE_UPLOAD_MAX_MEMORY_SIZE"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_MAX_MEMORY_SIZE</span></code><a class="headerlink" href="#file-upload-max-memory-size" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">2621440</span></code> (i.e. 2.5 MB).</p> <p>The maximum size (in bytes) that an upload will be before it gets streamed to the file system. See <a class="reference internal" href="../../topics/files/"><span class="doc">Managing files</span></a> for details.</p> <p>See also <a class="reference internal" href="#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATA_UPLOAD_MAX_MEMORY_SIZE</span></code></a>.</p> </div> <div class="section" id="s-file-upload-directory-permissions"> <span id="s-std:setting-FILE_UPLOAD_DIRECTORY_PERMISSIONS"></span><span id="file-upload-directory-permissions"></span><span id="std:setting-FILE_UPLOAD_DIRECTORY_PERMISSIONS"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_DIRECTORY_PERMISSIONS</span></code><a class="headerlink" href="#file-upload-directory-permissions" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The numeric mode to apply to directories created in the process of uploading files.</p> <p>This setting also determines the default permissions for collected static directories when using the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> management command. See <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> for details on overriding it.</p> <p>This value mirrors the functionality and caveats of the <a class="reference internal" href="#std:setting-FILE_UPLOAD_PERMISSIONS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_PERMISSIONS</span></code></a> setting.</p> </div> <div class="section" id="s-file-upload-permissions"> <span id="s-std:setting-FILE_UPLOAD_PERMISSIONS"></span><span id="file-upload-permissions"></span><span id="std:setting-FILE_UPLOAD_PERMISSIONS"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_PERMISSIONS</span></code><a class="headerlink" href="#file-upload-permissions" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">0o644</span></code></p> <p>The numeric mode (i.e. <code class="docutils literal notranslate"><span class="pre">0o644</span></code>) to set newly uploaded files to. For more information about what these modes mean, see the documentation for <a class="reference external" href="https://docs.python.org/3/library/os.html#os.chmod" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">os.chmod()</span></code></a>.</p> <p>If <code class="docutils literal notranslate"><span class="pre">None</span></code>, you’ll get operating-system dependent behavior. On most platforms, temporary files will have a mode of <code class="docutils literal notranslate"><span class="pre">0o600</span></code>, and files saved from memory will be saved using the system’s standard umask.</p> <p>For security reasons, these permissions aren’t applied to the temporary files that are stored in <a class="reference internal" href="#std:setting-FILE_UPLOAD_TEMP_DIR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_TEMP_DIR</span></code></a>.</p> <p>This setting also determines the default permissions for collected static files when using the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> management command. See <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> for details on overriding it.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p><strong>Always prefix the mode with</strong> <code class="docutils literal notranslate"><span class="pre">0o</span></code> <strong>.</strong></p> <p class="last">If you’re not familiar with file modes, please note that the <code class="docutils literal notranslate"><span class="pre">0o</span></code> prefix is very important: it indicates an octal number, which is the way that modes must be specified. If you try to use <code class="docutils literal notranslate"><span class="pre">644</span></code>, you’ll get totally incorrect behavior.</p> </div> <div class="versionchanged"> <span class="title">Changed in Django 3.0:</span> <p>In older versions, the default value is <code class="docutils literal notranslate"><span class="pre">None</span></code>.</p> </div> </div> <div class="section" id="s-file-upload-temp-dir"> <span id="s-std:setting-FILE_UPLOAD_TEMP_DIR"></span><span id="file-upload-temp-dir"></span><span id="std:setting-FILE_UPLOAD_TEMP_DIR"></span><h3><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_TEMP_DIR</span></code><a class="headerlink" href="#file-upload-temp-dir" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The directory to store data to (typically files larger than <a class="reference internal" href="#std:setting-FILE_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_MAX_MEMORY_SIZE</span></code></a>) temporarily while uploading files. If <code class="docutils literal notranslate"><span class="pre">None</span></code>, Django will use the standard temporary directory for the operating system. For example, this will default to <code class="docutils literal notranslate"><span class="pre">/tmp</span></code> on *nix-style operating systems.</p> <p>See <a class="reference internal" href="../../topics/files/"><span class="doc">Managing files</span></a> for details.</p> </div> <div class="section" id="s-first-day-of-week"> <span id="s-std:setting-FIRST_DAY_OF_WEEK"></span><span id="first-day-of-week"></span><span id="std:setting-FIRST_DAY_OF_WEEK"></span><h3><code class="docutils literal notranslate"><span class="pre">FIRST_DAY_OF_WEEK</span></code><a class="headerlink" href="#first-day-of-week" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">0</span></code> (Sunday)</p> <p>A number representing the first day of the week. This is especially useful when displaying a calendar. This value is only used when not using format internationalization, or when a format cannot be found for the current locale.</p> <p>The value must be an integer from 0 to 6, where 0 means Sunday, 1 means Monday and so on.</p> </div> <div class="section" id="s-fixture-dirs"> <span id="s-std:setting-FIXTURE_DIRS"></span><span id="fixture-dirs"></span><span id="std:setting-FIXTURE_DIRS"></span><h3><code class="docutils literal notranslate"><span class="pre">FIXTURE_DIRS</span></code><a class="headerlink" href="#fixture-dirs" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>List of directories searched for fixture files, in addition to the <code class="docutils literal notranslate"><span class="pre">fixtures</span></code> directory of each application, in search order.</p> <p>Note that these paths should use Unix-style forward slashes, even on Windows.</p> <p>See <a class="reference internal" href="../../howto/initial-data/#initial-data-via-fixtures"><span class="std std-ref">Providing data with fixtures</span></a> and <a class="reference internal" href="../../topics/testing/tools/#topics-testing-fixtures"><span class="std std-ref">Fixture loading</span></a>.</p> </div> <div class="section" id="s-force-script-name"> <span id="s-std:setting-FORCE_SCRIPT_NAME"></span><span id="force-script-name"></span><span id="std:setting-FORCE_SCRIPT_NAME"></span><h3><code class="docutils literal notranslate"><span class="pre">FORCE_SCRIPT_NAME</span></code><a class="headerlink" href="#force-script-name" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If not <code class="docutils literal notranslate"><span class="pre">None</span></code>, this will be used as the value of the <code class="docutils literal notranslate"><span class="pre">SCRIPT_NAME</span></code> environment variable in any HTTP request. This setting can be used to override the server-provided value of <code class="docutils literal notranslate"><span class="pre">SCRIPT_NAME</span></code>, which may be a rewritten version of the preferred value or not supplied at all. It is also used by <a class="reference internal" href="../applications/#django.setup" title="django.setup"><code class="xref py py-func docutils literal notranslate"><span class="pre">django.setup()</span></code></a> to set the URL resolver script prefix outside of the request/response cycle (e.g. in management commands and standalone scripts) to generate correct URLs when <code class="docutils literal notranslate"><span class="pre">SCRIPT_NAME</span></code> is not <code class="docutils literal notranslate"><span class="pre">/</span></code>.</p> </div> <div class="section" id="s-form-renderer"> <span id="s-std:setting-FORM_RENDERER"></span><span id="form-renderer"></span><span id="std:setting-FORM_RENDERER"></span><h3><code class="docutils literal notranslate"><span class="pre">FORM_RENDERER</span></code><a class="headerlink" href="#form-renderer" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'</span></code><a class="reference internal" href="../forms/renderers/#django.forms.renderers.DjangoTemplates" title="django.forms.renderers.DjangoTemplates"><code class="xref py py-class docutils literal notranslate"><span class="pre">django.forms.renderers.DjangoTemplates</span></code></a><code class="docutils literal notranslate"><span class="pre">'</span></code></p> <p>The class that renders form widgets. It must implement <a class="reference internal" href="../forms/renderers/#low-level-widget-render-api"><span class="std std-ref">the low-level render API</span></a>.</p> </div> <div class="section" id="s-format-module-path"> <span id="s-std:setting-FORMAT_MODULE_PATH"></span><span id="format-module-path"></span><span id="std:setting-FORMAT_MODULE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">FORMAT_MODULE_PATH</span></code><a class="headerlink" href="#format-module-path" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>A full Python path to a Python package that contains custom format definitions for project locales. If not <code class="docutils literal notranslate"><span class="pre">None</span></code>, Django will check for a <code class="docutils literal notranslate"><span class="pre">formats.py</span></code> file, under the directory named as the current locale, and will use the formats defined in this file.</p> <p>For example, if <a class="reference internal" href="#std:setting-FORMAT_MODULE_PATH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FORMAT_MODULE_PATH</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">mysite.formats</span></code>, and current language is <code class="docutils literal notranslate"><span class="pre">en</span></code> (English), Django will expect a directory tree like:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">mysite</span><span class="o">/</span> <span class="n">formats</span><span class="o">/</span> <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span> <span class="n">en</span><span class="o">/</span> <span class="fm">__init__</span><span class="o">.</span><span class="n">py</span> <span class="n">formats</span><span class="o">.</span><span class="n">py</span> </pre></div> </div> <p>You can also set this setting to a list of Python paths, for example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">FORMAT_MODULE_PATH</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">'mysite.formats'</span><span class="p">,</span> <span class="s1">'some_app.formats'</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> <p>When Django searches for a certain format, it will go through all given Python paths until it finds a module that actually defines the given format. This means that formats defined in packages farther up in the list will take precedence over the same formats in packages farther down.</p> <p>Available formats are:</p> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATE_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>,</li> <li><a class="reference internal" href="#std:setting-DATETIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DECIMAL_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#std:setting-FIRST_DAY_OF_WEEK"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FIRST_DAY_OF_WEEK</span></code></a></li> <li><a class="reference internal" href="#std:setting-MONTH_DAY_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MONTH_DAY_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a></li> <li><a class="reference internal" href="#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-YEAR_MONTH_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">YEAR_MONTH_FORMAT</span></code></a></li> </ul> </div> <div class="section" id="s-ignorable-404-urls"> <span id="s-std:setting-IGNORABLE_404_URLS"></span><span id="ignorable-404-urls"></span><span id="std:setting-IGNORABLE_404_URLS"></span><h3><code class="docutils literal notranslate"><span class="pre">IGNORABLE_404_URLS</span></code><a class="headerlink" href="#ignorable-404-urls" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>List of compiled regular expression objects describing URLs that should be ignored when reporting HTTP 404 errors via email (see <a class="reference internal" href="../../howto/error-reporting/"><span class="doc">Error reporting</span></a>). Regular expressions are matched against <a class="reference internal" href="../request-response/#django.http.HttpRequest.get_full_path" title="django.http.HttpRequest.get_full_path"><code class="xref py py-meth docutils literal notranslate"><span class="pre">request's</span> <span class="pre">full</span> <span class="pre">paths</span></code></a> (including query string, if any). Use this if your site does not provide a commonly requested file such as <code class="docutils literal notranslate"><span class="pre">favicon.ico</span></code> or <code class="docutils literal notranslate"><span class="pre">robots.txt</span></code>.</p> <p>This is only used if <a class="reference internal" href="../middleware/#django.middleware.common.BrokenLinkEmailsMiddleware" title="django.middleware.common.BrokenLinkEmailsMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">BrokenLinkEmailsMiddleware</span></code></a> is enabled (see <a class="reference internal" href="../../topics/http/middleware/"><span class="doc">Middleware</span></a>).</p> </div> <div class="section" id="s-installed-apps"> <span id="s-std:setting-INSTALLED_APPS"></span><span id="installed-apps"></span><span id="std:setting-INSTALLED_APPS"></span><h3><code class="docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code><a class="headerlink" href="#installed-apps" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of strings designating all applications that are enabled in this Django installation. Each string should be a dotted Python path to:</p> <ul class="simple"> <li>an application configuration class (preferred), or</li> <li>a package containing an application.</li> </ul> <p><a class="reference internal" href="../applications/"><span class="doc">Learn more about application configurations</span></a>.</p> <div class="admonition-use-the-application-registry-for-introspection admonition"> <p class="first admonition-title">Use the application registry for introspection</p> <p class="last">Your code should never access <a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> directly. Use <a class="reference internal" href="../applications/#django.apps.apps" title="django.apps.apps"><code class="xref py py-attr docutils literal notranslate"><span class="pre">django.apps.apps</span></code></a> instead.</p> </div> <div class="admonition-application-names-and-labels-must-be-unique-in-setting-installed-apps admonition"> <p class="first admonition-title">Application names and labels must be unique in <a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a></p> <p>Application <a class="reference internal" href="../applications/#django.apps.AppConfig.name" title="django.apps.AppConfig.name"><code class="xref py py-attr docutils literal notranslate"><span class="pre">names</span></code></a> — the dotted Python path to the application package — must be unique. There is no way to include the same application twice, short of duplicating its code under another name.</p> <p>Application <a class="reference internal" href="../applications/#django.apps.AppConfig.label" title="django.apps.AppConfig.label"><code class="xref py py-attr docutils literal notranslate"><span class="pre">labels</span></code></a> — by default the final part of the name — must be unique too. For example, you can’t include both <code class="docutils literal notranslate"><span class="pre">django.contrib.auth</span></code> and <code class="docutils literal notranslate"><span class="pre">myproject.auth</span></code>. However, you can relabel an application with a custom configuration that defines a different <a class="reference internal" href="../applications/#django.apps.AppConfig.label" title="django.apps.AppConfig.label"><code class="xref py py-attr docutils literal notranslate"><span class="pre">label</span></code></a>.</p> <p class="last">These rules apply regardless of whether <a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> references application configuration classes or application packages.</p> </div> <p>When several applications provide different versions of the same resource (template, static file, management command, translation), the application listed first in <a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> has precedence.</p> </div> <div class="section" id="s-internal-ips"> <span id="s-std:setting-INTERNAL_IPS"></span><span id="internal-ips"></span><span id="std:setting-INTERNAL_IPS"></span><h3><code class="docutils literal notranslate"><span class="pre">INTERNAL_IPS</span></code><a class="headerlink" href="#internal-ips" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of IP addresses, as strings, that:</p> <ul class="simple"> <li>Allow the <a class="reference internal" href="../templates/api/#django.template.context_processors.debug" title="django.template.context_processors.debug"><code class="xref py py-func docutils literal notranslate"><span class="pre">debug()</span></code></a> context processor to add some variables to the template context.</li> <li>Can use the <a class="reference internal" href="../contrib/admin/admindocs/#admindocs-bookmarklets"><span class="std std-ref">admindocs bookmarklets</span></a> even if not logged in as a staff user.</li> <li>Are marked as “internal” (as opposed to “EXTERNAL”) in <a class="reference internal" href="../../topics/logging/#django.utils.log.AdminEmailHandler" title="django.utils.log.AdminEmailHandler"><code class="xref py py-class docutils literal notranslate"><span class="pre">AdminEmailHandler</span></code></a> emails.</li> </ul> </div> <div class="section" id="s-language-code"> <span id="s-std:setting-LANGUAGE_CODE"></span><span id="language-code"></span><span id="std:setting-LANGUAGE_CODE"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code><a class="headerlink" href="#language-code" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'en-us'</span></code></p> <p>A string representing the language code for this installation. This should be in standard <a class="reference internal" href="../../topics/i18n/#term-language-code"><span class="xref std std-term">language ID format</span></a>. For example, U.S. English is <code class="docutils literal notranslate"><span class="pre">"en-us"</span></code>. See also the <a class="reference external" href="http://www.i18nguy.com/unicode/language-identifiers.html">list of language identifiers</a> and <a class="reference internal" href="../../topics/i18n/"><span class="doc">Internationalization and localization</span></a>.</p> <p><a class="reference internal" href="#std:setting-USE_I18N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_I18N</span></code></a> must be active for this setting to have any effect.</p> <p>It serves two purposes:</p> <ul class="simple"> <li>If the locale middleware isn’t in use, it decides which translation is served to all users.</li> <li>If the locale middleware is active, it provides a fallback language in case the user’s preferred language can’t be determined or is not supported by the website. It also provides the fallback translation when a translation for a given literal doesn’t exist for the user’s preferred language.</li> </ul> <p>See <a class="reference internal" href="../../topics/i18n/translation/#how-django-discovers-language-preference"><span class="std std-ref">How Django discovers language preference</span></a> for more details.</p> </div> <div class="section" id="s-language-cookie-age"> <span id="s-std:setting-LANGUAGE_COOKIE_AGE"></span><span id="language-cookie-age"></span><span id="std:setting-LANGUAGE_COOKIE_AGE"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_AGE</span></code><a class="headerlink" href="#language-cookie-age" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code> (expires at browser close)</p> <p>The age of the language cookie, in seconds.</p> </div> <div class="section" id="s-language-cookie-domain"> <span id="s-std:setting-LANGUAGE_COOKIE_DOMAIN"></span><span id="language-cookie-domain"></span><span id="std:setting-LANGUAGE_COOKIE_DOMAIN"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_DOMAIN</span></code><a class="headerlink" href="#language-cookie-domain" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The domain to use for the language cookie. Set this to a string such as <code class="docutils literal notranslate"><span class="pre">"example.com"</span></code> for cross-domain cookies, or use <code class="docutils literal notranslate"><span class="pre">None</span></code> for a standard domain cookie.</p> <p>Be cautious when updating this setting on a production site. If you update this setting to enable cross-domain cookies on a site that previously used standard domain cookies, existing user cookies that have the old domain will not be updated. This will result in site users being unable to switch the language as long as these cookies persist. The only safe and reliable option to perform the switch is to change the language cookie name permanently (via the <a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_NAME</span></code></a> setting) and to add a middleware that copies the value from the old cookie to a new one and then deletes the old one.</p> </div> <div class="section" id="s-language-cookie-httponly"> <span id="s-std:setting-LANGUAGE_COOKIE_HTTPONLY"></span><span id="language-cookie-httponly"></span><span id="std:setting-LANGUAGE_COOKIE_HTTPONLY"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_HTTPONLY</span></code><a class="headerlink" href="#language-cookie-httponly" title="Permalink to this headline">¶</a></h3> <div class="versionadded"> <span class="title">New in Django 3.0.</span> </div> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code> flag on the language cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, client-side JavaScript will not be able to access the language cookie.</p> <p>See <a class="reference internal" href="#std:setting-SESSION_COOKIE_HTTPONLY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_HTTPONLY</span></code></a> for details on <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code>.</p> </div> <div class="section" id="s-language-cookie-name"> <span id="s-std:setting-LANGUAGE_COOKIE_NAME"></span><span id="language-cookie-name"></span><span id="std:setting-LANGUAGE_COOKIE_NAME"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_NAME</span></code><a class="headerlink" href="#language-cookie-name" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django_language'</span></code></p> <p>The name of the cookie to use for the language cookie. This can be whatever you want (as long as it’s different from the other cookie names in your application). See <a class="reference internal" href="../../topics/i18n/"><span class="doc">Internationalization and localization</span></a>.</p> </div> <div class="section" id="s-language-cookie-path"> <span id="s-std:setting-LANGUAGE_COOKIE_PATH"></span><span id="language-cookie-path"></span><span id="std:setting-LANGUAGE_COOKIE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_PATH</span></code><a class="headerlink" href="#language-cookie-path" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'/'</span></code></p> <p>The path set on the language cookie. This should either match the URL path of your Django installation or be a parent of that path.</p> <p>This is useful if you have multiple Django instances running under the same hostname. They can use different cookie paths and each instance will only see its own language cookie.</p> <p>Be cautious when updating this setting on a production site. If you update this setting to use a deeper path than it previously used, existing user cookies that have the old path will not be updated. This will result in site users being unable to switch the language as long as these cookies persist. The only safe and reliable option to perform the switch is to change the language cookie name permanently (via the <a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_NAME</span></code></a> setting), and to add a middleware that copies the value from the old cookie to a new one and then deletes the one.</p> </div> <div class="section" id="s-language-cookie-samesite"> <span id="s-std:setting-LANGUAGE_COOKIE_SAMESITE"></span><span id="language-cookie-samesite"></span><span id="std:setting-LANGUAGE_COOKIE_SAMESITE"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SAMESITE</span></code><a class="headerlink" href="#language-cookie-samesite" title="Permalink to this headline">¶</a></h3> <div class="versionadded"> <span class="title">New in Django 3.0.</span> </div> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The value of the <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite">SameSite</a> flag on the language cookie. This flag prevents the cookie from being sent in cross-site requests.</p> <p>See <a class="reference internal" href="#std:setting-SESSION_COOKIE_SAMESITE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_SAMESITE</span></code></a> for details about <code class="docutils literal notranslate"><span class="pre">SameSite</span></code>.</p> </div> <div class="section" id="s-language-cookie-secure"> <span id="s-std:setting-LANGUAGE_COOKIE_SECURE"></span><span id="language-cookie-secure"></span><span id="std:setting-LANGUAGE_COOKIE_SECURE"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SECURE</span></code><a class="headerlink" href="#language-cookie-secure" title="Permalink to this headline">¶</a></h3> <div class="versionadded"> <span class="title">New in Django 3.0.</span> </div> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use a secure cookie for the language cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, the cookie will be marked as “secure”, which means browsers may ensure that the cookie is only sent under an HTTPS connection.</p> </div> <div class="section" id="s-languages"> <span id="s-std:setting-LANGUAGES"></span><span id="languages"></span><span id="std:setting-LANGUAGES"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGES</span></code><a class="headerlink" href="#languages" title="Permalink to this headline">¶</a></h3> <p>Default: A list of all available languages. This list is continually growing and including a copy here would inevitably become rapidly out of date. You can see the current list of translated languages by looking in <a class="reference external" href="https://github.com/django/django/blob/master/django/conf/global_settings.py">django/conf/global_settings.py</a>.</p> <p>The list is a list of two-tuples in the format (<a class="reference internal" href="../../topics/i18n/#term-language-code"><span class="xref std std-term">language code</span></a>, <code class="docutils literal notranslate"><span class="pre">language</span> <span class="pre">name</span></code>) – for example, <code class="docutils literal notranslate"><span class="pre">('ja',</span> <span class="pre">'Japanese')</span></code>. This specifies which languages are available for language selection. See <a class="reference internal" href="../../topics/i18n/"><span class="doc">Internationalization and localization</span></a>.</p> <p>Generally, the default value should suffice. Only set this setting if you want to restrict language selection to a subset of the Django-provided languages.</p> <p>If you define a custom <a class="reference internal" href="#std:setting-LANGUAGES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGES</span></code></a> setting, you can mark the language names as translation strings using the <a class="reference internal" href="../utils/#django.utils.translation.gettext_lazy" title="django.utils.translation.gettext_lazy"><code class="xref py py-func docutils literal notranslate"><span class="pre">gettext_lazy()</span></code></a> function.</p> <p>Here’s a sample settings file:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.utils.translation</span> <span class="kn">import</span> <span class="n">gettext_lazy</span> <span class="k">as</span> <span class="n">_</span> <span class="n">LANGUAGES</span> <span class="o">=</span> <span class="p">[</span> <span class="p">(</span><span class="s1">'de'</span><span class="p">,</span> <span class="n">_</span><span class="p">(</span><span class="s1">'German'</span><span class="p">)),</span> <span class="p">(</span><span class="s1">'en'</span><span class="p">,</span> <span class="n">_</span><span class="p">(</span><span class="s1">'English'</span><span class="p">)),</span> <span class="p">]</span> </pre></div> </div> </div> <div class="section" id="s-languages-bidi"> <span id="s-std:setting-LANGUAGES_BIDI"></span><span id="languages-bidi"></span><span id="std:setting-LANGUAGES_BIDI"></span><h3><code class="docutils literal notranslate"><span class="pre">LANGUAGES_BIDI</span></code><a class="headerlink" href="#languages-bidi" title="Permalink to this headline">¶</a></h3> <p>Default: A list of all language codes that are written right-to-left. You can see the current list of these languages by looking in <a class="reference external" href="https://github.com/django/django/blob/master/django/conf/global_settings.py">django/conf/global_settings.py</a>.</p> <p>The list contains <a class="reference internal" href="../../topics/i18n/#term-language-code"><span class="xref std std-term">language codes</span></a> for languages that are written right-to-left.</p> <p>Generally, the default value should suffice. Only set this setting if you want to restrict language selection to a subset of the Django-provided languages. If you define a custom <a class="reference internal" href="#std:setting-LANGUAGES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGES</span></code></a> setting, the list of bidirectional languages may contain language codes which are not enabled on a given site.</p> </div> <div class="section" id="s-locale-paths"> <span id="s-std:setting-LOCALE_PATHS"></span><span id="locale-paths"></span><span id="std:setting-LOCALE_PATHS"></span><h3><code class="docutils literal notranslate"><span class="pre">LOCALE_PATHS</span></code><a class="headerlink" href="#locale-paths" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of directories where Django looks for translation files. See <a class="reference internal" href="../../topics/i18n/translation/#how-django-discovers-translations"><span class="std std-ref">How Django discovers translations</span></a>.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">LOCALE_PATHS</span> <span class="o">=</span> <span class="p">[</span> <span class="s1">'/home/www/project/common_files/locale'</span><span class="p">,</span> <span class="s1">'/var/local/translations/locale'</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> <p>Django will look within each of these paths for the <code class="docutils literal notranslate"><span class="pre"><locale_code>/LC_MESSAGES</span></code> directories containing the actual translation files.</p> </div> <div class="section" id="s-logging"> <span id="s-std:setting-LOGGING"></span><span id="logging"></span><span id="std:setting-LOGGING"></span><h3><code class="docutils literal notranslate"><span class="pre">LOGGING</span></code><a class="headerlink" href="#logging" title="Permalink to this headline">¶</a></h3> <p>Default: A logging configuration dictionary.</p> <p>A data structure containing configuration information. The contents of this data structure will be passed as the argument to the configuration method described in <a class="reference internal" href="#std:setting-LOGGING_CONFIG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGGING_CONFIG</span></code></a>.</p> <p>Among other things, the default logging configuration passes HTTP 500 server errors to an email log handler when <a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>. See also <a class="reference internal" href="../../topics/logging/#configuring-logging"><span class="std std-ref">Configuring logging</span></a>.</p> <p>You can see the default logging configuration by looking in <a class="reference external" href="https://github.com/django/django/blob/master/django/utils/log.py">django/utils/log.py</a>.</p> </div> <div class="section" id="s-logging-config"> <span id="s-std:setting-LOGGING_CONFIG"></span><span id="logging-config"></span><span id="std:setting-LOGGING_CONFIG"></span><h3><code class="docutils literal notranslate"><span class="pre">LOGGING_CONFIG</span></code><a class="headerlink" href="#logging-config" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'logging.config.dictConfig'</span></code></p> <p>A path to a callable that will be used to configure logging in the Django project. Points at an instance of Python’s <a class="reference external" href="https://docs.python.org/3/library/logging.config.html#logging-config-dictschema" title="(in Python v3.9)"><span class="xref std std-ref">dictConfig</span></a> configuration method by default.</p> <p>If you set <a class="reference internal" href="#std:setting-LOGGING_CONFIG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGGING_CONFIG</span></code></a> to <code class="docutils literal notranslate"><span class="pre">None</span></code>, the logging configuration process will be skipped.</p> </div> <div class="section" id="s-managers"> <span id="s-std:setting-MANAGERS"></span><span id="managers"></span><span id="std:setting-MANAGERS"></span><h3><code class="docutils literal notranslate"><span class="pre">MANAGERS</span></code><a class="headerlink" href="#managers" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list in the same format as <a class="reference internal" href="#std:setting-ADMINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ADMINS</span></code></a> that specifies who should get broken link notifications when <a class="reference internal" href="../middleware/#django.middleware.common.BrokenLinkEmailsMiddleware" title="django.middleware.common.BrokenLinkEmailsMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">BrokenLinkEmailsMiddleware</span></code></a> is enabled.</p> </div> <div class="section" id="s-media-root"> <span id="s-std:setting-MEDIA_ROOT"></span><span id="media-root"></span><span id="std:setting-MEDIA_ROOT"></span><h3><code class="docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code><a class="headerlink" href="#media-root" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>Absolute filesystem path to the directory that will hold <a class="reference internal" href="../../topics/files/"><span class="doc">user-uploaded files</span></a>.</p> <p>Example: <code class="docutils literal notranslate"><span class="pre">"/var/www/example.com/media/"</span></code></p> <p>See also <a class="reference internal" href="#std:setting-MEDIA_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_URL</span></code></a>.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last"><a class="reference internal" href="#std:setting-MEDIA_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a> and <a class="reference internal" href="#std:setting-STATIC_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a> must have different values. Before <a class="reference internal" href="#std:setting-STATIC_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a> was introduced, it was common to rely or fallback on <a class="reference internal" href="#std:setting-MEDIA_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a> to also serve static files; however, since this can have serious security implications, there is a validation check to prevent it.</p> </div> </div> <div class="section" id="s-media-url"> <span id="s-std:setting-MEDIA_URL"></span><span id="media-url"></span><span id="std:setting-MEDIA_URL"></span><h3><code class="docutils literal notranslate"><span class="pre">MEDIA_URL</span></code><a class="headerlink" href="#media-url" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>URL that handles the media served from <a class="reference internal" href="#std:setting-MEDIA_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a>, used for <a class="reference internal" href="../../topics/files/"><span class="doc">managing stored files</span></a>. It must end in a slash if set to a non-empty value. You will need to <a class="reference internal" href="../../howto/static-files/#serving-uploaded-files-in-development"><span class="std std-ref">configure these files to be served</span></a> in both development and production environments.</p> <p>If you want to use <code class="docutils literal notranslate"><span class="pre">{{</span> <span class="pre">MEDIA_URL</span> <span class="pre">}}</span></code> in your templates, add <code class="docutils literal notranslate"><span class="pre">'django.template.context_processors.media'</span></code> in the <code class="docutils literal notranslate"><span class="pre">'context_processors'</span></code> option of <a class="reference internal" href="#std:setting-TEMPLATES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEMPLATES</span></code></a>.</p> <p>Example: <code class="docutils literal notranslate"><span class="pre">"http://media.example.com/"</span></code></p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">There are security risks if you are accepting uploaded content from untrusted users! See the security guide’s topic on <a class="reference internal" href="../../topics/security/#user-uploaded-content-security"><span class="std std-ref">User-uploaded content</span></a> for mitigation details.</p> </div> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last"><a class="reference internal" href="#std:setting-MEDIA_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_URL</span></code></a> and <a class="reference internal" href="#std:setting-STATIC_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_URL</span></code></a> must have different values. See <a class="reference internal" href="#std:setting-MEDIA_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a> for more details.</p> </div> </div> <div class="section" id="s-middleware"> <span id="s-std:setting-MIDDLEWARE"></span><span id="middleware"></span><span id="std:setting-MIDDLEWARE"></span><h3><code class="docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code><a class="headerlink" href="#middleware" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>A list of middleware to use. See <a class="reference internal" href="../../topics/http/middleware/"><span class="doc">Middleware</span></a>.</p> </div> <div class="section" id="s-migration-modules"> <span id="s-std:setting-MIGRATION_MODULES"></span><span id="migration-modules"></span><span id="std:setting-MIGRATION_MODULES"></span><h3><code class="docutils literal notranslate"><span class="pre">MIGRATION_MODULES</span></code><a class="headerlink" href="#migration-modules" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dictionary)</p> <p>A dictionary specifying the package where migration modules can be found on a per-app basis. The default value of this setting is an empty dictionary, but the default package name for migration modules is <code class="docutils literal notranslate"><span class="pre">migrations</span></code>.</p> <p>Example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span><span class="s1">'blog'</span><span class="p">:</span> <span class="s1">'blog.db_migrations'</span><span class="p">}</span> </pre></div> </div> <p>In this case, migrations pertaining to the <code class="docutils literal notranslate"><span class="pre">blog</span></code> app will be contained in the <code class="docutils literal notranslate"><span class="pre">blog.db_migrations</span></code> package.</p> <p>If you provide the <code class="docutils literal notranslate"><span class="pre">app_label</span></code> argument, <a class="reference internal" href="../django-admin/#django-admin-makemigrations"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">makemigrations</span></code></a> will automatically create the package if it doesn’t already exist.</p> <p>When you supply <code class="docutils literal notranslate"><span class="pre">None</span></code> as a value for an app, Django will consider the app as an app without migrations regardless of an existing <code class="docutils literal notranslate"><span class="pre">migrations</span></code> submodule. This can be used, for example, in a test settings file to skip migrations while testing (tables will still be created for the apps’ models). If this is used in your general project settings, remember to use the <a class="reference internal" href="../django-admin/#cmdoption-migrate-run-syncdb"><code class="xref std std-option docutils literal notranslate"><span class="pre">migrate</span> <span class="pre">--run-syncdb</span></code></a> option if you want to create tables for the app.</p> </div> <div class="section" id="s-month-day-format"> <span id="s-std:setting-MONTH_DAY_FORMAT"></span><span id="month-day-format"></span><span id="std:setting-MONTH_DAY_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">MONTH_DAY_FORMAT</span></code><a class="headerlink" href="#month-day-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'F</span> <span class="pre">j'</span></code></p> <p>The default formatting to use for date fields on Django admin change-list pages – and, possibly, by other parts of the system – in cases when only the month and day are displayed.</p> <p>For example, when a Django admin change-list page is being filtered by a date drilldown, the header for a given day displays the day and month. Different locales have different formats. For example, U.S. English would say “January 1,” whereas Spanish might say “1 Enero.”</p> <p>Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the corresponding locale-dictated format has higher precedence and will be applied.</p> <p>See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>. See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-YEAR_MONTH_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">YEAR_MONTH_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-number-grouping"> <span id="s-std:setting-NUMBER_GROUPING"></span><span id="number-grouping"></span><span id="std:setting-NUMBER_GROUPING"></span><h3><code class="docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code><a class="headerlink" href="#number-grouping" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">0</span></code></p> <p>Number of digits grouped together on the integer part of a number.</p> <p>Common use is to display a thousand separator. If this setting is <code class="docutils literal notranslate"><span class="pre">0</span></code>, then no grouping will be applied to the number. If this setting is greater than <code class="docutils literal notranslate"><span class="pre">0</span></code>, then <a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a> will be used as the separator between those groups.</p> <p>Some locales use non-uniform digit grouping, e.g. <code class="docutils literal notranslate"><span class="pre">10,00,00,000</span></code> in <code class="docutils literal notranslate"><span class="pre">en_IN</span></code>. For this case, you can provide a sequence with the number of digit group sizes to be applied. The first number defines the size of the group preceding the decimal delimiter, and each number that follows defines the size of preceding groups. If the sequence is terminated with <code class="docutils literal notranslate"><span class="pre">-1</span></code>, no further grouping is performed. If the sequence terminates with a <code class="docutils literal notranslate"><span class="pre">0</span></code>, the last group size is used for the remainder of the number.</p> <p>Example tuple for <code class="docutils literal notranslate"><span class="pre">en_IN</span></code>:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">NUMBER_GROUPING</span> <span class="o">=</span> <span class="p">(</span><span class="mi">3</span><span class="p">,</span> <span class="mi">2</span><span class="p">,</span> <span class="mi">0</span><span class="p">)</span> </pre></div> </div> <p>Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-DECIMAL_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a>, <a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a> and <a class="reference internal" href="#std:setting-USE_THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a>.</p> </div> <div class="section" id="s-prepend-www"> <span id="s-std:setting-PREPEND_WWW"></span><span id="prepend-www"></span><span id="std:setting-PREPEND_WWW"></span><h3><code class="docutils literal notranslate"><span class="pre">PREPEND_WWW</span></code><a class="headerlink" href="#prepend-www" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to prepend the “www.” subdomain to URLs that don’t have it. This is only used if <a class="reference internal" href="../middleware/#django.middleware.common.CommonMiddleware" title="django.middleware.common.CommonMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">CommonMiddleware</span></code></a> is installed (see <a class="reference internal" href="../../topics/http/middleware/"><span class="doc">Middleware</span></a>). See also <a class="reference internal" href="#std:setting-APPEND_SLASH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code></a>.</p> </div> <div class="section" id="s-root-urlconf"> <span id="s-std:setting-ROOT_URLCONF"></span><span id="root-urlconf"></span><span id="std:setting-ROOT_URLCONF"></span><h3><code class="docutils literal notranslate"><span class="pre">ROOT_URLCONF</span></code><a class="headerlink" href="#root-urlconf" title="Permalink to this headline">¶</a></h3> <p>Default: Not defined</p> <p>A string representing the full Python import path to your root URLconf, for example <code class="docutils literal notranslate"><span class="pre">"mydjangoapps.urls"</span></code>. Can be overridden on a per-request basis by setting the attribute <code class="docutils literal notranslate"><span class="pre">urlconf</span></code> on the incoming <code class="docutils literal notranslate"><span class="pre">HttpRequest</span></code> object. See <a class="reference internal" href="../../topics/http/urls/#how-django-processes-a-request"><span class="std std-ref">How Django processes a request</span></a> for details.</p> </div> <div class="section" id="s-secret-key"> <span id="s-std:setting-SECRET_KEY"></span><span id="secret-key"></span><span id="std:setting-SECRET_KEY"></span><h3><code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code><a class="headerlink" href="#secret-key" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">''</span></code> (Empty string)</p> <p>A secret key for a particular Django installation. This is used to provide <a class="reference internal" href="../../topics/signing/"><span class="doc">cryptographic signing</span></a>, and should be set to a unique, unpredictable value.</p> <p><a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> automatically adds a randomly-generated <code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code> to each new project.</p> <p>Uses of the key shouldn’t assume that it’s text or bytes. Every use should go through <a class="reference internal" href="../utils/#django.utils.encoding.force_str" title="django.utils.encoding.force_str"><code class="xref py py-func docutils literal notranslate"><span class="pre">force_str()</span></code></a> or <a class="reference internal" href="../utils/#django.utils.encoding.force_bytes" title="django.utils.encoding.force_bytes"><code class="xref py py-func docutils literal notranslate"><span class="pre">force_bytes()</span></code></a> to convert it to the desired type.</p> <p>Django will refuse to start if <a class="reference internal" href="#std:setting-SECRET_KEY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a> is not set.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p><strong>Keep this value secret.</strong></p> <p class="last">Running Django with a known <a class="reference internal" href="#std:setting-SECRET_KEY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a> defeats many of Django’s security protections, and can lead to privilege escalation and remote code execution vulnerabilities.</p> </div> <p>The secret key is used for:</p> <ul class="simple"> <li>All <a class="reference internal" href="../../topics/http/sessions/"><span class="doc">sessions</span></a> if you are using any other session backend than <code class="docutils literal notranslate"><span class="pre">django.contrib.sessions.backends.cache</span></code>, or are using the default <a class="reference internal" href="../../topics/auth/customizing/#django.contrib.auth.models.AbstractBaseUser.get_session_auth_hash" title="django.contrib.auth.models.AbstractBaseUser.get_session_auth_hash"><code class="xref py py-meth docutils literal notranslate"><span class="pre">get_session_auth_hash()</span></code></a>.</li> <li>All <a class="reference internal" href="../contrib/messages/"><span class="doc">messages</span></a> if you are using <a class="reference internal" href="../contrib/messages/#django.contrib.messages.storage.cookie.CookieStorage" title="django.contrib.messages.storage.cookie.CookieStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">CookieStorage</span></code></a> or <a class="reference internal" href="../contrib/messages/#django.contrib.messages.storage.fallback.FallbackStorage" title="django.contrib.messages.storage.fallback.FallbackStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">FallbackStorage</span></code></a>.</li> <li>All <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.views.PasswordResetView" title="django.contrib.auth.views.PasswordResetView"><code class="xref py py-class docutils literal notranslate"><span class="pre">PasswordResetView</span></code></a> tokens.</li> <li>Any usage of <a class="reference internal" href="../../topics/signing/"><span class="doc">cryptographic signing</span></a>, unless a different key is provided.</li> </ul> <p>If you rotate your secret key, all of the above will be invalidated. Secret keys are not used for passwords of users and key rotation will not affect them.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> creates a unique <code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code> for convenience.</p> </div> </div> <div class="section" id="s-secure-browser-xss-filter"> <span id="s-std:setting-SECURE_BROWSER_XSS_FILTER"></span><span id="secure-browser-xss-filter"></span><span id="std:setting-SECURE_BROWSER_XSS_FILTER"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_BROWSER_XSS_FILTER</span></code><a class="headerlink" href="#secure-browser-xss-filter" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> sets the <a class="reference internal" href="../middleware/#x-xss-protection"><span class="std std-ref">X-XSS-Protection: 1; mode=block</span></a> header on all responses that do not already have it.</p> <p>Modern browsers don’t honor <code class="docutils literal notranslate"><span class="pre">X-XSS-Protection</span></code> HTTP header anymore. Although the setting offers little practical benefit, you may still want to set the header if you support older browsers.</p> </div> <div class="section" id="s-secure-content-type-nosniff"> <span id="s-std:setting-SECURE_CONTENT_TYPE_NOSNIFF"></span><span id="secure-content-type-nosniff"></span><span id="std:setting-SECURE_CONTENT_TYPE_NOSNIFF"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_CONTENT_TYPE_NOSNIFF</span></code><a class="headerlink" href="#secure-content-type-nosniff" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> sets the <a class="reference internal" href="../middleware/#x-content-type-options"><span class="std std-ref">X-Content-Type-Options: nosniff</span></a> header on all responses that do not already have it.</p> <div class="versionchanged"> <span class="title">Changed in Django 3.0:</span> <p>In older versions, the default value is <code class="docutils literal notranslate"><span class="pre">False</span></code>.</p> </div> </div> <div class="section" id="s-secure-hsts-include-subdomains"> <span id="s-std:setting-SECURE_HSTS_INCLUDE_SUBDOMAINS"></span><span id="secure-hsts-include-subdomains"></span><span id="std:setting-SECURE_HSTS_INCLUDE_SUBDOMAINS"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_INCLUDE_SUBDOMAINS</span></code><a class="headerlink" href="#secure-hsts-include-subdomains" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> adds the <code class="docutils literal notranslate"><span class="pre">includeSubDomains</span></code> directive to the <a class="reference internal" href="../middleware/#http-strict-transport-security"><span class="std std-ref">HTTP Strict Transport Security</span></a> header. It has no effect unless <a class="reference internal" href="#std:setting-SECURE_HSTS_SECONDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code></a> is set to a non-zero value.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Setting this incorrectly can irreversibly (for the value of <a class="reference internal" href="#std:setting-SECURE_HSTS_SECONDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code></a>) break your site. Read the <a class="reference internal" href="../middleware/#http-strict-transport-security"><span class="std std-ref">HTTP Strict Transport Security</span></a> documentation first.</p> </div> </div> <div class="section" id="s-secure-hsts-preload"> <span id="s-std:setting-SECURE_HSTS_PRELOAD"></span><span id="secure-hsts-preload"></span><span id="std:setting-SECURE_HSTS_PRELOAD"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_PRELOAD</span></code><a class="headerlink" href="#secure-hsts-preload" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> adds the <code class="docutils literal notranslate"><span class="pre">preload</span></code> directive to the <a class="reference internal" href="../middleware/#http-strict-transport-security"><span class="std std-ref">HTTP Strict Transport Security</span></a> header. It has no effect unless <a class="reference internal" href="#std:setting-SECURE_HSTS_SECONDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code></a> is set to a non-zero value.</p> </div> <div class="section" id="s-secure-hsts-seconds"> <span id="s-std:setting-SECURE_HSTS_SECONDS"></span><span id="secure-hsts-seconds"></span><span id="std:setting-SECURE_HSTS_SECONDS"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code><a class="headerlink" href="#secure-hsts-seconds" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">0</span></code></p> <p>If set to a non-zero integer value, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> sets the <a class="reference internal" href="../middleware/#http-strict-transport-security"><span class="std std-ref">HTTP Strict Transport Security</span></a> header on all responses that do not already have it.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">Setting this incorrectly can irreversibly (for some time) break your site. Read the <a class="reference internal" href="../middleware/#http-strict-transport-security"><span class="std std-ref">HTTP Strict Transport Security</span></a> documentation first.</p> </div> </div> <div class="section" id="s-secure-proxy-ssl-header"> <span id="s-std:setting-SECURE_PROXY_SSL_HEADER"></span><span id="secure-proxy-ssl-header"></span><span id="std:setting-SECURE_PROXY_SSL_HEADER"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_PROXY_SSL_HEADER</span></code><a class="headerlink" href="#secure-proxy-ssl-header" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>A tuple representing a HTTP header/value combination that signifies a request is secure. This controls the behavior of the request object’s <code class="docutils literal notranslate"><span class="pre">is_secure()</span></code> method.</p> <p>By default, <code class="docutils literal notranslate"><span class="pre">is_secure()</span></code> determines if a request is secure by confirming that a requested URL uses <code class="docutils literal notranslate"><span class="pre">https://</span></code>. This method is important for Django’s CSRF protection, and it may be used by your own code or third-party apps.</p> <p>If your Django app is behind a proxy, though, the proxy may be “swallowing” whether the original request uses HTTPS or not. If there is a non-HTTPS connection between the proxy and Django then <code class="docutils literal notranslate"><span class="pre">is_secure()</span></code> would always return <code class="docutils literal notranslate"><span class="pre">False</span></code> – even for requests that were made via HTTPS by the end user. In contrast, if there is an HTTPS connection between the proxy and Django then <code class="docutils literal notranslate"><span class="pre">is_secure()</span></code> would always return <code class="docutils literal notranslate"><span class="pre">True</span></code> – even for requests that were made originally via HTTP.</p> <p>In this situation, configure your proxy to set a custom HTTP header that tells Django whether the request came in via HTTPS, and set <code class="docutils literal notranslate"><span class="pre">SECURE_PROXY_SSL_HEADER</span></code> so that Django knows what header to look for.</p> <p>Set a tuple with two elements – the name of the header to look for and the required value. For example:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">SECURE_PROXY_SSL_HEADER</span> <span class="o">=</span> <span class="p">(</span><span class="s1">'HTTP_X_FORWARDED_PROTO'</span><span class="p">,</span> <span class="s1">'https'</span><span class="p">)</span> </pre></div> </div> <p>This tells Django to trust the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Proto</span></code> header that comes from our proxy, and any time its value is <code class="docutils literal notranslate"><span class="pre">'https'</span></code>, then the request is guaranteed to be secure (i.e., it originally came in via HTTPS).</p> <p>You should <em>only</em> set this setting if you control your proxy or have some other guarantee that it sets/strips this header appropriately.</p> <p>Note that the header needs to be in the format as used by <code class="docutils literal notranslate"><span class="pre">request.META</span></code> – all caps and likely starting with <code class="docutils literal notranslate"><span class="pre">HTTP_</span></code>. (Remember, Django automatically adds <code class="docutils literal notranslate"><span class="pre">'HTTP_'</span></code> to the start of x-header names before making the header available in <code class="docutils literal notranslate"><span class="pre">request.META</span></code>.)</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p><strong>Modifying this setting can compromise your site’s security. Ensure you fully understand your setup before changing it.</strong></p> <p>Make sure ALL of the following are true before setting this (assuming the values from the example above):</p> <ul class="simple"> <li>Your Django app is behind a proxy.</li> <li>Your proxy strips the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Proto</span></code> header from all incoming requests. In other words, if end users include that header in their requests, the proxy will discard it.</li> <li>Your proxy sets the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Proto</span></code> header and sends it to Django, but only for requests that originally come in via HTTPS.</li> </ul> <p class="last">If any of those are not true, you should keep this setting set to <code class="docutils literal notranslate"><span class="pre">None</span></code> and find another way of determining HTTPS, perhaps via custom middleware.</p> </div> </div> <div class="section" id="s-secure-redirect-exempt"> <span id="s-std:setting-SECURE_REDIRECT_EXEMPT"></span><span id="secure-redirect-exempt"></span><span id="std:setting-SECURE_REDIRECT_EXEMPT"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_REDIRECT_EXEMPT</span></code><a class="headerlink" href="#secure-redirect-exempt" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>If a URL path matches a regular expression in this list, the request will not be redirected to HTTPS. The <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> strips leading slashes from URL paths, so patterns shouldn’t include them, e.g. <code class="docutils literal notranslate"><span class="pre">SECURE_REDIRECT_EXEMPT</span> <span class="pre">=</span> <span class="pre">[r'^no-ssl/$',</span> <span class="pre">…]</span></code>. If <a class="reference internal" href="#std:setting-SECURE_SSL_REDIRECT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_SSL_REDIRECT</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, this setting has no effect.</p> </div> <div class="section" id="s-secure-referrer-policy"> <span id="s-std:setting-SECURE_REFERRER_POLICY"></span><span id="secure-referrer-policy"></span><span id="std:setting-SECURE_REFERRER_POLICY"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_REFERRER_POLICY</span></code><a class="headerlink" href="#secure-referrer-policy" title="Permalink to this headline">¶</a></h3> <div class="versionadded"> <span class="title">New in Django 3.0.</span> </div> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If configured, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> sets the <a class="reference internal" href="../middleware/#referrer-policy"><span class="std std-ref">Referrer Policy</span></a> header on all responses that do not already have it to the value provided.</p> </div> <div class="section" id="s-secure-ssl-host"> <span id="s-std:setting-SECURE_SSL_HOST"></span><span id="secure-ssl-host"></span><span id="std:setting-SECURE_SSL_HOST"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_SSL_HOST</span></code><a class="headerlink" href="#secure-ssl-host" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If a string (e.g. <code class="docutils literal notranslate"><span class="pre">secure.example.com</span></code>), all SSL redirects will be directed to this host rather than the originally-requested host (e.g. <code class="docutils literal notranslate"><span class="pre">www.example.com</span></code>). If <a class="reference internal" href="#std:setting-SECURE_SSL_REDIRECT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_SSL_REDIRECT</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, this setting has no effect.</p> </div> <div class="section" id="s-secure-ssl-redirect"> <span id="s-std:setting-SECURE_SSL_REDIRECT"></span><span id="secure-ssl-redirect"></span><span id="std:setting-SECURE_SSL_REDIRECT"></span><h3><code class="docutils literal notranslate"><span class="pre">SECURE_SSL_REDIRECT</span></code><a class="headerlink" href="#secure-ssl-redirect" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>If <code class="docutils literal notranslate"><span class="pre">True</span></code>, the <a class="reference internal" href="../middleware/#django.middleware.security.SecurityMiddleware" title="django.middleware.security.SecurityMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">SecurityMiddleware</span></code></a> <a class="reference internal" href="../middleware/#ssl-redirect"><span class="std std-ref">redirects</span></a> all non-HTTPS requests to HTTPS (except for those URLs matching a regular expression listed in <a class="reference internal" href="#std:setting-SECURE_REDIRECT_EXEMPT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_REDIRECT_EXEMPT</span></code></a>).</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">If turning this to <code class="docutils literal notranslate"><span class="pre">True</span></code> causes infinite redirects, it probably means your site is running behind a proxy and can’t tell which requests are secure and which are not. Your proxy likely sets a header to indicate secure requests; you can correct the problem by finding out what that header is and configuring the <a class="reference internal" href="#std:setting-SECURE_PROXY_SSL_HEADER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_PROXY_SSL_HEADER</span></code></a> setting accordingly.</p> </div> </div> <div class="section" id="s-serialization-modules"> <span id="s-std:setting-SERIALIZATION_MODULES"></span><span id="serialization-modules"></span><span id="std:setting-SERIALIZATION_MODULES"></span><h3><code class="docutils literal notranslate"><span class="pre">SERIALIZATION_MODULES</span></code><a class="headerlink" href="#serialization-modules" title="Permalink to this headline">¶</a></h3> <p>Default: Not defined</p> <p>A dictionary of modules containing serializer definitions (provided as strings), keyed by a string identifier for that serialization type. For example, to define a YAML serializer, use:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">SERIALIZATION_MODULES</span> <span class="o">=</span> <span class="p">{</span><span class="s1">'yaml'</span><span class="p">:</span> <span class="s1">'path.to.yaml_serializer'</span><span class="p">}</span> </pre></div> </div> </div> <div class="section" id="s-server-email"> <span id="s-std:setting-SERVER_EMAIL"></span><span id="server-email"></span><span id="std:setting-SERVER_EMAIL"></span><h3><code class="docutils literal notranslate"><span class="pre">SERVER_EMAIL</span></code><a class="headerlink" href="#server-email" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'root@localhost'</span></code></p> <p>The email address that error messages come from, such as those sent to <a class="reference internal" href="#std:setting-ADMINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ADMINS</span></code></a> and <a class="reference internal" href="#std:setting-MANAGERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MANAGERS</span></code></a>.</p> <div class="admonition-why-are-my-emails-sent-from-a-different-address admonition"> <p class="first admonition-title">Why are my emails sent from a different address?</p> <p class="last">This address is used only for error messages. It is <em>not</em> the address that regular email messages sent with <a class="reference internal" href="../../topics/email/#django.core.mail.send_mail" title="django.core.mail.send_mail"><code class="xref py py-meth docutils literal notranslate"><span class="pre">send_mail()</span></code></a> come from; for that, see <a class="reference internal" href="#std:setting-DEFAULT_FROM_EMAIL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_FROM_EMAIL</span></code></a>.</p> </div> </div> <div class="section" id="s-short-date-format"> <span id="s-std:setting-SHORT_DATE_FORMAT"></span><span id="short-date-format"></span><span id="std:setting-SHORT_DATE_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code><a class="headerlink" href="#short-date-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'m/d/Y'</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">12/31/2003</span></code>)</p> <p>An available formatting that can be used for displaying date fields on templates. Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the corresponding locale-dictated format has higher precedence and will be applied. See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-short-datetime-format"> <span id="s-std:setting-SHORT_DATETIME_FORMAT"></span><span id="short-datetime-format"></span><span id="std:setting-SHORT_DATETIME_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code><a class="headerlink" href="#short-datetime-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'m/d/Y</span> <span class="pre">P'</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">12/31/2003</span> <span class="pre">4</span> <span class="pre">p.m.</span></code>)</p> <p>An available formatting that can be used for displaying datetime fields on templates. Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the corresponding locale-dictated format has higher precedence and will be applied. See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-signing-backend"> <span id="s-std:setting-SIGNING_BACKEND"></span><span id="signing-backend"></span><span id="std:setting-SIGNING_BACKEND"></span><h3><code class="docutils literal notranslate"><span class="pre">SIGNING_BACKEND</span></code><a class="headerlink" href="#signing-backend" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.core.signing.TimestampSigner'</span></code></p> <p>The backend used for signing cookies and other data.</p> <p>See also the <a class="reference internal" href="../../topics/signing/"><span class="doc">Cryptographic signing</span></a> documentation.</p> </div> <div class="section" id="s-silenced-system-checks"> <span id="s-std:setting-SILENCED_SYSTEM_CHECKS"></span><span id="silenced-system-checks"></span><span id="std:setting-SILENCED_SYSTEM_CHECKS"></span><h3><code class="docutils literal notranslate"><span class="pre">SILENCED_SYSTEM_CHECKS</span></code><a class="headerlink" href="#silenced-system-checks" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list of identifiers of messages generated by the system check framework (i.e. <code class="docutils literal notranslate"><span class="pre">["models.W001"]</span></code>) that you wish to permanently acknowledge and ignore. Silenced checks will not be output to the console.</p> <p>See also the <a class="reference internal" href="../checks/"><span class="doc">System check framework</span></a> documentation.</p> </div> <div class="section" id="s-templates"> <span id="s-std:setting-TEMPLATES"></span><span id="templates"></span><span id="std:setting-TEMPLATES"></span><h3><code class="docutils literal notranslate"><span class="pre">TEMPLATES</span></code><a class="headerlink" href="#templates" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>A list containing the settings for all template engines to be used with Django. Each item of the list is a dictionary containing the options for an individual engine.</p> <p>Here’s a setup that tells the Django template engine to load templates from the <code class="docutils literal notranslate"><span class="pre">templates</span></code> subdirectory inside each installed application:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">TEMPLATES</span> <span class="o">=</span> <span class="p">[</span> <span class="p">{</span> <span class="s1">'BACKEND'</span><span class="p">:</span> <span class="s1">'django.template.backends.django.DjangoTemplates'</span><span class="p">,</span> <span class="s1">'APP_DIRS'</span><span class="p">:</span> <span class="kc">True</span><span class="p">,</span> <span class="p">},</span> <span class="p">]</span> </pre></div> </div> <p>The following options are available for all backends.</p> <div class="section" id="s-std:setting-TEMPLATES-BACKEND"> <span id="s-id6"></span><span id="std:setting-TEMPLATES-BACKEND"></span><span id="id6"></span><h4><code class="docutils literal notranslate"><span class="pre">BACKEND</span></code><a class="headerlink" href="#std:setting-TEMPLATES-BACKEND" title="Permalink to this headline">¶</a></h4> <p>Default: Not defined</p> <p>The template backend to use. The built-in template backends are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.template.backends.django.DjangoTemplates'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.template.backends.jinja2.Jinja2'</span></code></li> </ul> <p>You can use a template backend that doesn’t ship with Django by setting <code class="docutils literal notranslate"><span class="pre">BACKEND</span></code> to a fully-qualified path (i.e. <code class="docutils literal notranslate"><span class="pre">'mypackage.whatever.Backend'</span></code>).</p> </div> <div class="section" id="s-std:setting-TEMPLATES-NAME"> <span id="s-id7"></span><span id="std:setting-TEMPLATES-NAME"></span><span id="id7"></span><h4><code class="docutils literal notranslate"><span class="pre">NAME</span></code><a class="headerlink" href="#std:setting-TEMPLATES-NAME" title="Permalink to this headline">¶</a></h4> <p>Default: see below</p> <p>The alias for this particular template engine. It’s an identifier that allows selecting an engine for rendering. Aliases must be unique across all configured template engines.</p> <p>It defaults to the name of the module defining the engine class, i.e. the next to last piece of <a class="reference internal" href="#std:setting-TEMPLATES-BACKEND"><code class="xref std std-setting docutils literal notranslate"><span class="pre">BACKEND</span></code></a>, when it isn’t provided. For example if the backend is <code class="docutils literal notranslate"><span class="pre">'mypackage.whatever.Backend'</span></code> then its default name is <code class="docutils literal notranslate"><span class="pre">'whatever'</span></code>.</p> </div> <div class="section" id="s-dirs"> <span id="s-std:setting-TEMPLATES-DIRS"></span><span id="dirs"></span><span id="std:setting-TEMPLATES-DIRS"></span><h4><code class="docutils literal notranslate"><span class="pre">DIRS</span></code><a class="headerlink" href="#dirs" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>Directories where the engine should look for template source files, in search order.</p> </div> <div class="section" id="s-app-dirs"> <span id="s-std:setting-TEMPLATES-APP_DIRS"></span><span id="app-dirs"></span><span id="std:setting-TEMPLATES-APP_DIRS"></span><h4><code class="docutils literal notranslate"><span class="pre">APP_DIRS</span></code><a class="headerlink" href="#app-dirs" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether the engine should look for template source files inside installed applications.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> sets <code class="docutils literal notranslate"><span class="pre">'APP_DIRS':</span> <span class="pre">True</span></code>.</p> </div> </div> <div class="section" id="s-std:setting-TEMPLATES-OPTIONS"> <span id="s-id8"></span><span id="std:setting-TEMPLATES-OPTIONS"></span><span id="id8"></span><h4><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code><a class="headerlink" href="#std:setting-TEMPLATES-OPTIONS" title="Permalink to this headline">¶</a></h4> <p>Default: <code class="docutils literal notranslate"><span class="pre">{}</span></code> (Empty dict)</p> <p>Extra parameters to pass to the template backend. Available parameters vary depending on the template backend. See <a class="reference internal" href="../../topics/templates/#django.template.backends.django.DjangoTemplates" title="django.template.backends.django.DjangoTemplates"><code class="xref py py-class docutils literal notranslate"><span class="pre">DjangoTemplates</span></code></a> and <a class="reference internal" href="../../topics/templates/#django.template.backends.jinja2.Jinja2" title="django.template.backends.jinja2.Jinja2"><code class="xref py py-class docutils literal notranslate"><span class="pre">Jinja2</span></code></a> for the options of the built-in backends.</p> </div> </div> <div class="section" id="s-test-runner"> <span id="s-std:setting-TEST_RUNNER"></span><span id="test-runner"></span><span id="std:setting-TEST_RUNNER"></span><h3><code class="docutils literal notranslate"><span class="pre">TEST_RUNNER</span></code><a class="headerlink" href="#test-runner" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.test.runner.DiscoverRunner'</span></code></p> <p>The name of the class to use for starting the test suite. See <a class="reference internal" href="../../topics/testing/advanced/#other-testing-frameworks"><span class="std std-ref">Using different testing frameworks</span></a>.</p> </div> <div class="section" id="s-test-non-serialized-apps"> <span id="s-std:setting-TEST_NON_SERIALIZED_APPS"></span><span id="test-non-serialized-apps"></span><span id="std:setting-TEST_NON_SERIALIZED_APPS"></span><h3><code class="docutils literal notranslate"><span class="pre">TEST_NON_SERIALIZED_APPS</span></code><a class="headerlink" href="#test-non-serialized-apps" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>In order to restore the database state between tests for <code class="docutils literal notranslate"><span class="pre">TransactionTestCase</span></code>s and database backends without transactions, Django will <a class="reference internal" href="../../topics/testing/overview/#test-case-serialized-rollback"><span class="std std-ref">serialize the contents of all apps</span></a> when it starts the test run so it can then reload from that copy before running tests that need it.</p> <p>This slows down the startup time of the test runner; if you have apps that you know don’t need this feature, you can add their full names in here (e.g. <code class="docutils literal notranslate"><span class="pre">'django.contrib.contenttypes'</span></code>) to exclude them from this serialization process.</p> </div> <div class="section" id="s-thousand-separator"> <span id="s-std:setting-THOUSAND_SEPARATOR"></span><span id="thousand-separator"></span><span id="std:setting-THOUSAND_SEPARATOR"></span><h3><code class="docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code><a class="headerlink" href="#thousand-separator" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">','</span></code> (Comma)</p> <p>Default thousand separator used when formatting numbers. This setting is used only when <a class="reference internal" href="#std:setting-USE_THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code> and <a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a> is greater than <code class="docutils literal notranslate"><span class="pre">0</span></code>.</p> <p>Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a>, <a class="reference internal" href="#std:setting-DECIMAL_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a> and <a class="reference internal" href="#std:setting-USE_THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a>.</p> </div> <div class="section" id="s-time-format"> <span id="s-std:setting-TIME_FORMAT"></span><span id="time-format"></span><span id="std:setting-TIME_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code><a class="headerlink" href="#time-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'P'</span></code> (e.g. <code class="docutils literal notranslate"><span class="pre">4</span> <span class="pre">p.m.</span></code>)</p> <p>The default formatting to use for displaying time fields in any part of the system. Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the locale-dictated format has higher precedence and will be applied instead. See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-time-input-formats"> <span id="s-std:setting-TIME_INPUT_FORMATS"></span><span id="time-input-formats"></span><span id="std:setting-TIME_INPUT_FORMATS"></span><h3><code class="docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code><a class="headerlink" href="#time-input-formats" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'%H:%M:%S'</span><span class="p">,</span> <span class="c1"># '14:30:59'</span> <span class="s1">'%H:%M:%S.</span><span class="si">%f</span><span class="s1">'</span><span class="p">,</span> <span class="c1"># '14:30:59.000200'</span> <span class="s1">'%H:%M'</span><span class="p">,</span> <span class="c1"># '14:30'</span> <span class="p">]</span> </pre></div> </div> <p>A list of formats that will be accepted when inputting data on a time field. Formats will be tried in order, using the first valid one. Note that these format strings use Python’s <a class="reference external" href="https://docs.python.org/3/library/datetime.html#strftime-strptime-behavior" title="(in Python v3.9)"><span class="xref std std-ref">datetime module syntax</span></a>, not the format strings from the <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">date</span></code></a> template filter.</p> <p>When <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, the locale-dictated format has higher precedence and will be applied instead.</p> <p>See also <a class="reference internal" href="#std:setting-DATE_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code></a> and <a class="reference internal" href="#std:setting-DATETIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code></a>.</p> </div> <div class="section" id="s-std:setting-TIME_ZONE"> <span id="s-id9"></span><span id="std:setting-TIME_ZONE"></span><span id="id9"></span><h3><code class="docutils literal notranslate"><span class="pre">TIME_ZONE</span></code><a class="headerlink" href="#std:setting-TIME_ZONE" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'America/Chicago'</span></code></p> <p>A string representing the time zone for this installation. See the <a class="reference external" href="https://en.wikipedia.org/wiki/List_of_tz_database_time_zones">list of time zones</a>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Since Django was first released with the <a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a> set to <code class="docutils literal notranslate"><span class="pre">'America/Chicago'</span></code>, the global setting (used if nothing is defined in your project’s <code class="docutils literal notranslate"><span class="pre">settings.py</span></code>) remains <code class="docutils literal notranslate"><span class="pre">'America/Chicago'</span></code> for backwards compatibility. New project templates default to <code class="docutils literal notranslate"><span class="pre">'UTC'</span></code>.</p> </div> <p>Note that this isn’t necessarily the time zone of the server. For example, one server may serve multiple Django-powered sites, each with a separate time zone setting.</p> <p>When <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">False</span></code>, this is the time zone in which Django will store all datetimes. When <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a> is <code class="docutils literal notranslate"><span class="pre">True</span></code>, this is the default time zone that Django will use to display datetimes in templates and to interpret datetimes entered in forms.</p> <p>On Unix environments (where <a class="reference external" href="https://docs.python.org/3/library/time.html#time.tzset" title="(in Python v3.9)"><code class="xref py py-func docutils literal notranslate"><span class="pre">time.tzset()</span></code></a> is implemented), Django sets the <code class="docutils literal notranslate"><span class="pre">os.environ['TZ']</span></code> variable to the time zone you specify in the <a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a> setting. Thus, all your views and models will automatically operate in this time zone. However, Django won’t set the <code class="docutils literal notranslate"><span class="pre">TZ</span></code> environment variable if you’re using the manual configuration option as described in <a class="reference internal" href="../../topics/settings/#settings-without-django-settings-module"><span class="std std-ref">manually configuring settings</span></a>. If Django doesn’t set the <code class="docutils literal notranslate"><span class="pre">TZ</span></code> environment variable, it’s up to you to ensure your processes are running in the correct environment.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">Django cannot reliably use alternate time zones in a Windows environment. If you’re running Django on Windows, <a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a> must be set to match the system time zone.</p> </div> </div> <div class="section" id="s-use-i18n"> <span id="s-std:setting-USE_I18N"></span><span id="use-i18n"></span><span id="std:setting-USE_I18N"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_I18N</span></code><a class="headerlink" href="#use-i18n" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>A boolean that specifies whether Django’s translation system should be enabled. This provides a way to turn it off, for performance. If this is set to <code class="docutils literal notranslate"><span class="pre">False</span></code>, Django will make some optimizations so as not to load the translation machinery.</p> <p>See also <a class="reference internal" href="#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a>, <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> and <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> includes <code class="docutils literal notranslate"><span class="pre">USE_I18N</span> <span class="pre">=</span> <span class="pre">True</span></code> for convenience.</p> </div> </div> <div class="section" id="s-use-l10n"> <span id="s-std:setting-USE_L10N"></span><span id="use-l10n"></span><span id="std:setting-USE_L10N"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_L10N</span></code><a class="headerlink" href="#use-l10n" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that specifies if localized formatting of data will be enabled by default or not. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, e.g. Django will display numbers and dates using the format of the current locale.</p> <p>See also <a class="reference internal" href="#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a>, <a class="reference internal" href="#std:setting-USE_I18N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_I18N</span></code></a> and <a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> includes <code class="docutils literal notranslate"><span class="pre">USE_L10N</span> <span class="pre">=</span> <span class="pre">True</span></code> for convenience.</p> </div> </div> <div class="section" id="s-use-thousand-separator"> <span id="s-std:setting-USE_THOUSAND_SEPARATOR"></span><span id="use-thousand-separator"></span><span id="std:setting-USE_THOUSAND_SEPARATOR"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code><a class="headerlink" href="#use-thousand-separator" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that specifies whether to display numbers using a thousand separator. When set to <code class="docutils literal notranslate"><span class="pre">True</span></code> and <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is also <code class="docutils literal notranslate"><span class="pre">True</span></code>, Django will format numbers using the <a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a> and <a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a> settings. These settings may also be dictated by the locale, which takes precedence.</p> <p>See also <a class="reference internal" href="#std:setting-DECIMAL_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a>, <a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a> and <a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a>.</p> </div> <div class="section" id="s-use-tz"> <span id="s-std:setting-USE_TZ"></span><span id="use-tz"></span><span id="std:setting-USE_TZ"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_TZ</span></code><a class="headerlink" href="#use-tz" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that specifies if datetimes will be timezone-aware by default or not. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, Django will use timezone-aware datetimes internally. Otherwise, Django will use naive datetimes in local time.</p> <p>See also <a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a>, <a class="reference internal" href="#std:setting-USE_I18N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_I18N</span></code></a> and <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a>.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">The default <code class="file docutils literal notranslate"><span class="pre">settings.py</span></code> file created by <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> includes <code class="docutils literal notranslate"><span class="pre">USE_TZ</span> <span class="pre">=</span> <span class="pre">True</span></code> for convenience.</p> </div> </div> <div class="section" id="s-use-x-forwarded-host"> <span id="s-std:setting-USE_X_FORWARDED_HOST"></span><span id="use-x-forwarded-host"></span><span id="std:setting-USE_X_FORWARDED_HOST"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_X_FORWARDED_HOST</span></code><a class="headerlink" href="#use-x-forwarded-host" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that specifies whether to use the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Host</span></code> header in preference to the <code class="docutils literal notranslate"><span class="pre">Host</span></code> header. This should only be enabled if a proxy which sets this header is in use.</p> <p>This setting takes priority over <a class="reference internal" href="#std:setting-USE_X_FORWARDED_PORT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_PORT</span></code></a>. Per <span class="target" id="index-0"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc7239.html#section-5.3"><strong>RFC 7239#section-5.3</strong></a>, the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Host</span></code> header can include the port number, in which case you shouldn’t use <a class="reference internal" href="#std:setting-USE_X_FORWARDED_PORT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_PORT</span></code></a>.</p> </div> <div class="section" id="s-use-x-forwarded-port"> <span id="s-std:setting-USE_X_FORWARDED_PORT"></span><span id="use-x-forwarded-port"></span><span id="std:setting-USE_X_FORWARDED_PORT"></span><h3><code class="docutils literal notranslate"><span class="pre">USE_X_FORWARDED_PORT</span></code><a class="headerlink" href="#use-x-forwarded-port" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>A boolean that specifies whether to use the <code class="docutils literal notranslate"><span class="pre">X-Forwarded-Port</span></code> header in preference to the <code class="docutils literal notranslate"><span class="pre">SERVER_PORT</span></code> <code class="docutils literal notranslate"><span class="pre">META</span></code> variable. This should only be enabled if a proxy which sets this header is in use.</p> <p><a class="reference internal" href="#std:setting-USE_X_FORWARDED_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_HOST</span></code></a> takes priority over this setting.</p> </div> <div class="section" id="s-wsgi-application"> <span id="s-std:setting-WSGI_APPLICATION"></span><span id="wsgi-application"></span><span id="std:setting-WSGI_APPLICATION"></span><h3><code class="docutils literal notranslate"><span class="pre">WSGI_APPLICATION</span></code><a class="headerlink" href="#wsgi-application" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The full Python path of the WSGI application object that Django’s built-in servers (e.g. <a class="reference internal" href="../django-admin/#django-admin-runserver"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">runserver</span></code></a>) will use. The <a class="reference internal" href="../django-admin/#django-admin-startproject"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">django-admin</span> <span class="pre">startproject</span></code></a> management command will create a standard <code class="docutils literal notranslate"><span class="pre">wsgi.py</span></code> file with an <code class="docutils literal notranslate"><span class="pre">application</span></code> callable in it, and point this setting to that <code class="docutils literal notranslate"><span class="pre">application</span></code>.</p> <p>If not set, the return value of <code class="docutils literal notranslate"><span class="pre">django.core.wsgi.get_wsgi_application()</span></code> will be used. In this case, the behavior of <a class="reference internal" href="../django-admin/#django-admin-runserver"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">runserver</span></code></a> will be identical to previous Django versions.</p> </div> <div class="section" id="s-year-month-format"> <span id="s-std:setting-YEAR_MONTH_FORMAT"></span><span id="year-month-format"></span><span id="std:setting-YEAR_MONTH_FORMAT"></span><h3><code class="docutils literal notranslate"><span class="pre">YEAR_MONTH_FORMAT</span></code><a class="headerlink" href="#year-month-format" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'F</span> <span class="pre">Y'</span></code></p> <p>The default formatting to use for date fields on Django admin change-list pages – and, possibly, by other parts of the system – in cases when only the year and month are displayed.</p> <p>For example, when a Django admin change-list page is being filtered by a date drilldown, the header for a given month displays the month and the year. Different locales have different formats. For example, U.S. English would say “January 2006,” whereas another locale might say “2006/January.”</p> <p>Note that if <a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a> is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, then the corresponding locale-dictated format has higher precedence and will be applied.</p> <p>See <a class="reference internal" href="../templates/builtins/#std:templatefilter-date"><code class="xref std std-tfilter docutils literal notranslate"><span class="pre">allowed</span> <span class="pre">date</span> <span class="pre">format</span> <span class="pre">strings</span></code></a>. See also <a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a>, <a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a> and <a class="reference internal" href="#std:setting-MONTH_DAY_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MONTH_DAY_FORMAT</span></code></a>.</p> </div> <div class="section" id="s-x-frame-options"> <span id="s-std:setting-X_FRAME_OPTIONS"></span><span id="x-frame-options"></span><span id="std:setting-X_FRAME_OPTIONS"></span><h3><code class="docutils literal notranslate"><span class="pre">X_FRAME_OPTIONS</span></code><a class="headerlink" href="#x-frame-options" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'DENY'</span></code></p> <p>The default value for the X-Frame-Options header used by <a class="reference internal" href="../middleware/#django.middleware.clickjacking.XFrameOptionsMiddleware" title="django.middleware.clickjacking.XFrameOptionsMiddleware"><code class="xref py py-class docutils literal notranslate"><span class="pre">XFrameOptionsMiddleware</span></code></a>. See the <a class="reference internal" href="../clickjacking/"><span class="doc">clickjacking protection</span></a> documentation.</p> <div class="versionchanged"> <span class="title">Changed in Django 3.0:</span> <p>In older versions, the default value is <code class="docutils literal notranslate"><span class="pre">SAMEORIGIN</span></code>.</p> </div> </div> </div> <div class="section" id="s-auth"> <span id="auth"></span><h2><a class="toc-backref" href="#id13">Auth</a><a class="headerlink" href="#auth" title="Permalink to this headline">¶</a></h2> <p>Settings for <a class="reference internal" href="../../topics/auth/#module-django.contrib.auth" title="django.contrib.auth: Django's authentication framework."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.auth</span></code></a>.</p> <div class="section" id="s-authentication-backends"> <span id="s-std:setting-AUTHENTICATION_BACKENDS"></span><span id="authentication-backends"></span><span id="std:setting-AUTHENTICATION_BACKENDS"></span><h3><code class="docutils literal notranslate"><span class="pre">AUTHENTICATION_BACKENDS</span></code><a class="headerlink" href="#authentication-backends" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">['django.contrib.auth.backends.ModelBackend']</span></code></p> <p>A list of authentication backend classes (as strings) to use when attempting to authenticate a user. See the <a class="reference internal" href="../../topics/auth/customizing/#authentication-backends"><span class="std std-ref">authentication backends documentation</span></a> for details.</p> </div> <div class="section" id="s-auth-user-model"> <span id="s-std:setting-AUTH_USER_MODEL"></span><span id="auth-user-model"></span><span id="std:setting-AUTH_USER_MODEL"></span><h3><code class="docutils literal notranslate"><span class="pre">AUTH_USER_MODEL</span></code><a class="headerlink" href="#auth-user-model" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'auth.User'</span></code></p> <p>The model to use to represent a User. See <a class="reference internal" href="../../topics/auth/customizing/#auth-custom-user"><span class="std std-ref">Substituting a custom User model</span></a>.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">You cannot change the AUTH_USER_MODEL setting during the lifetime of a project (i.e. once you have made and migrated models that depend on it) without serious effort. It is intended to be set at the project start, and the model it refers to must be available in the first migration of the app that it lives in. See <a class="reference internal" href="../../topics/auth/customizing/#auth-custom-user"><span class="std std-ref">Substituting a custom User model</span></a> for more details.</p> </div> </div> <div class="section" id="s-login-redirect-url"> <span id="s-std:setting-LOGIN_REDIRECT_URL"></span><span id="login-redirect-url"></span><span id="std:setting-LOGIN_REDIRECT_URL"></span><h3><code class="docutils literal notranslate"><span class="pre">LOGIN_REDIRECT_URL</span></code><a class="headerlink" href="#login-redirect-url" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'/accounts/profile/'</span></code></p> <p>The URL or <a class="reference internal" href="../../topics/http/urls/#naming-url-patterns"><span class="std std-ref">named URL pattern</span></a> where requests are redirected after login when the <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.views.LoginView" title="django.contrib.auth.views.LoginView"><code class="xref py py-class docutils literal notranslate"><span class="pre">LoginView</span></code></a> doesn’t get a <code class="docutils literal notranslate"><span class="pre">next</span></code> GET parameter.</p> </div> <div class="section" id="s-login-url"> <span id="s-std:setting-LOGIN_URL"></span><span id="login-url"></span><span id="std:setting-LOGIN_URL"></span><h3><code class="docutils literal notranslate"><span class="pre">LOGIN_URL</span></code><a class="headerlink" href="#login-url" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'/accounts/login/'</span></code></p> <p>The URL or <a class="reference internal" href="../../topics/http/urls/#naming-url-patterns"><span class="std std-ref">named URL pattern</span></a> where requests are redirected for login when using the <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.decorators.login_required" title="django.contrib.auth.decorators.login_required"><code class="xref py py-func docutils literal notranslate"><span class="pre">login_required()</span></code></a> decorator, <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.mixins.LoginRequiredMixin" title="django.contrib.auth.mixins.LoginRequiredMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">LoginRequiredMixin</span></code></a>, or <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.mixins.AccessMixin" title="django.contrib.auth.mixins.AccessMixin"><code class="xref py py-class docutils literal notranslate"><span class="pre">AccessMixin</span></code></a>.</p> </div> <div class="section" id="s-logout-redirect-url"> <span id="s-std:setting-LOGOUT_REDIRECT_URL"></span><span id="logout-redirect-url"></span><span id="std:setting-LOGOUT_REDIRECT_URL"></span><h3><code class="docutils literal notranslate"><span class="pre">LOGOUT_REDIRECT_URL</span></code><a class="headerlink" href="#logout-redirect-url" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The URL or <a class="reference internal" href="../../topics/http/urls/#naming-url-patterns"><span class="std std-ref">named URL pattern</span></a> where requests are redirected after logout if <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.views.LogoutView" title="django.contrib.auth.views.LogoutView"><code class="xref py py-class docutils literal notranslate"><span class="pre">LogoutView</span></code></a> doesn’t have a <code class="docutils literal notranslate"><span class="pre">next_page</span></code> attribute.</p> <p>If <code class="docutils literal notranslate"><span class="pre">None</span></code>, no redirect will be performed and the logout view will be rendered.</p> </div> <div class="section" id="s-password-reset-timeout-days"> <span id="s-std:setting-PASSWORD_RESET_TIMEOUT_DAYS"></span><span id="password-reset-timeout-days"></span><span id="std:setting-PASSWORD_RESET_TIMEOUT_DAYS"></span><h3><code class="docutils literal notranslate"><span class="pre">PASSWORD_RESET_TIMEOUT_DAYS</span></code><a class="headerlink" href="#password-reset-timeout-days" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">3</span></code></p> <p>The minimum number of days a password reset link is valid for. Depending on when the link is generated, it will be valid for up to a day longer.</p> <p>Used by the <a class="reference internal" href="../../topics/auth/default/#django.contrib.auth.views.PasswordResetConfirmView" title="django.contrib.auth.views.PasswordResetConfirmView"><code class="xref py py-class docutils literal notranslate"><span class="pre">PasswordResetConfirmView</span></code></a>.</p> </div> <div class="section" id="s-password-hashers"> <span id="s-std:setting-PASSWORD_HASHERS"></span><span id="password-hashers"></span><span id="std:setting-PASSWORD_HASHERS"></span><h3><code class="docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code><a class="headerlink" href="#password-hashers" title="Permalink to this headline">¶</a></h3> <p>See <a class="reference internal" href="../../topics/auth/passwords/#auth-password-storage"><span class="std std-ref">How Django stores passwords</span></a>.</p> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'django.contrib.auth.hashers.PBKDF2PasswordHasher'</span><span class="p">,</span> <span class="s1">'django.contrib.auth.hashers.PBKDF2SHA1PasswordHasher'</span><span class="p">,</span> <span class="s1">'django.contrib.auth.hashers.Argon2PasswordHasher'</span><span class="p">,</span> <span class="s1">'django.contrib.auth.hashers.BCryptSHA256PasswordHasher'</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> </div> <div class="section" id="s-auth-password-validators"> <span id="s-std:setting-AUTH_PASSWORD_VALIDATORS"></span><span id="auth-password-validators"></span><span id="std:setting-AUTH_PASSWORD_VALIDATORS"></span><h3><code class="docutils literal notranslate"><span class="pre">AUTH_PASSWORD_VALIDATORS</span></code><a class="headerlink" href="#auth-password-validators" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>The list of validators that are used to check the strength of user’s passwords. See <a class="reference internal" href="../../topics/auth/passwords/#password-validation"><span class="std std-ref">Password validation</span></a> for more details. By default, no validation is performed and all passwords are accepted.</p> </div> </div> <div class="section" id="s-messages"> <span id="s-settings-messages"></span><span id="messages"></span><span id="settings-messages"></span><h2><a class="toc-backref" href="#id14">Messages</a><a class="headerlink" href="#messages" title="Permalink to this headline">¶</a></h2> <p>Settings for <a class="reference internal" href="../contrib/messages/#module-django.contrib.messages" title="django.contrib.messages: Provides cookie- and session-based temporary message storage."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.messages</span></code></a>.</p> <div class="section" id="s-message-level"> <span id="s-std:setting-MESSAGE_LEVEL"></span><span id="message-level"></span><span id="std:setting-MESSAGE_LEVEL"></span><h3><code class="docutils literal notranslate"><span class="pre">MESSAGE_LEVEL</span></code><a class="headerlink" href="#message-level" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">messages.INFO</span></code></p> <p>Sets the minimum message level that will be recorded by the messages framework. See <a class="reference internal" href="../contrib/messages/#message-level"><span class="std std-ref">message levels</span></a> for more details.</p> <div class="admonition-important admonition"> <p class="first admonition-title">Important</p> <p>If you override <code class="docutils literal notranslate"><span class="pre">MESSAGE_LEVEL</span></code> in your settings file and rely on any of the built-in constants, you must import the constants module directly to avoid the potential for circular imports, e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.messages</span> <span class="kn">import</span> <span class="n">constants</span> <span class="k">as</span> <span class="n">message_constants</span> <span class="n">MESSAGE_LEVEL</span> <span class="o">=</span> <span class="n">message_constants</span><span class="o">.</span><span class="n">DEBUG</span> </pre></div> </div> <p class="last">If desired, you may specify the numeric values for the constants directly according to the values in the above <a class="reference internal" href="../contrib/messages/#message-level-constants"><span class="std std-ref">constants table</span></a>.</p> </div> </div> <div class="section" id="s-message-storage"> <span id="s-std:setting-MESSAGE_STORAGE"></span><span id="message-storage"></span><span id="std:setting-MESSAGE_STORAGE"></span><h3><code class="docutils literal notranslate"><span class="pre">MESSAGE_STORAGE</span></code><a class="headerlink" href="#message-storage" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.contrib.messages.storage.fallback.FallbackStorage'</span></code></p> <p>Controls where Django stores message data. Valid values are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.messages.storage.fallback.FallbackStorage'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.messages.storage.session.SessionStorage'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.messages.storage.cookie.CookieStorage'</span></code></li> </ul> <p>See <a class="reference internal" href="../contrib/messages/#message-storage-backends"><span class="std std-ref">message storage backends</span></a> for more details.</p> <p>The backends that use cookies – <a class="reference internal" href="../contrib/messages/#django.contrib.messages.storage.cookie.CookieStorage" title="django.contrib.messages.storage.cookie.CookieStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">CookieStorage</span></code></a> and <a class="reference internal" href="../contrib/messages/#django.contrib.messages.storage.fallback.FallbackStorage" title="django.contrib.messages.storage.fallback.FallbackStorage"><code class="xref py py-class docutils literal notranslate"><span class="pre">FallbackStorage</span></code></a> – use the value of <a class="reference internal" href="#std:setting-SESSION_COOKIE_DOMAIN"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_DOMAIN</span></code></a>, <a class="reference internal" href="#std:setting-SESSION_COOKIE_SECURE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_SECURE</span></code></a> and <a class="reference internal" href="#std:setting-SESSION_COOKIE_HTTPONLY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SESSION_COOKIE_HTTPONLY</span></code></a> when setting their cookies.</p> </div> <div class="section" id="s-message-tags"> <span id="s-std:setting-MESSAGE_TAGS"></span><span id="message-tags"></span><span id="std:setting-MESSAGE_TAGS"></span><h3><code class="docutils literal notranslate"><span class="pre">MESSAGE_TAGS</span></code><a class="headerlink" href="#message-tags" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">{</span> <span class="n">messages</span><span class="o">.</span><span class="n">DEBUG</span><span class="p">:</span> <span class="s1">'debug'</span><span class="p">,</span> <span class="n">messages</span><span class="o">.</span><span class="n">INFO</span><span class="p">:</span> <span class="s1">'info'</span><span class="p">,</span> <span class="n">messages</span><span class="o">.</span><span class="n">SUCCESS</span><span class="p">:</span> <span class="s1">'success'</span><span class="p">,</span> <span class="n">messages</span><span class="o">.</span><span class="n">WARNING</span><span class="p">:</span> <span class="s1">'warning'</span><span class="p">,</span> <span class="n">messages</span><span class="o">.</span><span class="n">ERROR</span><span class="p">:</span> <span class="s1">'error'</span><span class="p">,</span> <span class="p">}</span> </pre></div> </div> <p>This sets the mapping of message level to message tag, which is typically rendered as a CSS class in HTML. If you specify a value, it will extend the default. This means you only have to specify those values which you need to override. See <a class="reference internal" href="../contrib/messages/#message-displaying"><span class="std std-ref">Displaying messages</span></a> above for more details.</p> <div class="admonition-important admonition"> <p class="first admonition-title">Important</p> <p>If you override <code class="docutils literal notranslate"><span class="pre">MESSAGE_TAGS</span></code> in your settings file and rely on any of the built-in constants, you must import the <code class="docutils literal notranslate"><span class="pre">constants</span></code> module directly to avoid the potential for circular imports, e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="kn">from</span> <span class="nn">django.contrib.messages</span> <span class="kn">import</span> <span class="n">constants</span> <span class="k">as</span> <span class="n">message_constants</span> <span class="n">MESSAGE_TAGS</span> <span class="o">=</span> <span class="p">{</span><span class="n">message_constants</span><span class="o">.</span><span class="n">INFO</span><span class="p">:</span> <span class="s1">''</span><span class="p">}</span> </pre></div> </div> <p class="last">If desired, you may specify the numeric values for the constants directly according to the values in the above <a class="reference internal" href="../contrib/messages/#message-level-constants"><span class="std std-ref">constants table</span></a>.</p> </div> </div> </div> <div class="section" id="s-sessions"> <span id="s-settings-sessions"></span><span id="sessions"></span><span id="settings-sessions"></span><h2><a class="toc-backref" href="#id15">Sessions</a><a class="headerlink" href="#sessions" title="Permalink to this headline">¶</a></h2> <p>Settings for <a class="reference internal" href="../../topics/http/sessions/#module-django.contrib.sessions" title="django.contrib.sessions: Provides session management for Django projects."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sessions</span></code></a>.</p> <div class="section" id="s-session-cache-alias"> <span id="s-std:setting-SESSION_CACHE_ALIAS"></span><span id="session-cache-alias"></span><span id="std:setting-SESSION_CACHE_ALIAS"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_CACHE_ALIAS</span></code><a class="headerlink" href="#session-cache-alias" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'default'</span></code></p> <p>If you’re using <a class="reference internal" href="../../topics/http/sessions/#cached-sessions-backend"><span class="std std-ref">cache-based session storage</span></a>, this selects the cache to use.</p> </div> <div class="section" id="s-session-cookie-age"> <span id="s-std:setting-SESSION_COOKIE_AGE"></span><span id="session-cookie-age"></span><span id="std:setting-SESSION_COOKIE_AGE"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_AGE</span></code><a class="headerlink" href="#session-cookie-age" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">1209600</span></code> (2 weeks, in seconds)</p> <p>The age of session cookies, in seconds.</p> </div> <div class="section" id="s-session-cookie-domain"> <span id="s-std:setting-SESSION_COOKIE_DOMAIN"></span><span id="session-cookie-domain"></span><span id="std:setting-SESSION_COOKIE_DOMAIN"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_DOMAIN</span></code><a class="headerlink" href="#session-cookie-domain" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The domain to use for session cookies. Set this to a string such as <code class="docutils literal notranslate"><span class="pre">"example.com"</span></code> for cross-domain cookies, or use <code class="docutils literal notranslate"><span class="pre">None</span></code> for a standard domain cookie.</p> <p>Be cautious when updating this setting on a production site. If you update this setting to enable cross-domain cookies on a site that previously used standard domain cookies, existing user cookies will be set to the old domain. This may result in them being unable to log in as long as these cookies persist.</p> <p>This setting also affects cookies set by <a class="reference internal" href="../contrib/messages/#module-django.contrib.messages" title="django.contrib.messages: Provides cookie- and session-based temporary message storage."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.messages</span></code></a>.</p> </div> <div class="section" id="s-session-cookie-httponly"> <span id="s-std:setting-SESSION_COOKIE_HTTPONLY"></span><span id="session-cookie-httponly"></span><span id="std:setting-SESSION_COOKIE_HTTPONLY"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_HTTPONLY</span></code><a class="headerlink" href="#session-cookie-httponly" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">True</span></code></p> <p>Whether to use <code class="docutils literal notranslate"><span class="pre">HttpOnly</span></code> flag on the session cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, client-side JavaScript will not be able to access the session cookie.</p> <p><a class="reference external" href="https://owasp.org/www-community/HttpOnly">HttpOnly</a> is a flag included in a Set-Cookie HTTP response header. It’s part of the <span class="target" id="index-1"></span><a class="rfc reference external" href="https://tools.ietf.org/html/rfc6265.html#section-4.1.2.6"><strong>RFC 6265#section-4.1.2.6</strong></a> standard for cookies and can be a useful way to mitigate the risk of a client-side script accessing the protected cookie data.</p> <p>This makes it less trivial for an attacker to escalate a cross-site scripting vulnerability into full hijacking of a user’s session. There aren’t many good reasons for turning this off. Your code shouldn’t read session cookies from JavaScript.</p> </div> <div class="section" id="s-session-cookie-name"> <span id="s-std:setting-SESSION_COOKIE_NAME"></span><span id="session-cookie-name"></span><span id="std:setting-SESSION_COOKIE_NAME"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_NAME</span></code><a class="headerlink" href="#session-cookie-name" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'sessionid'</span></code></p> <p>The name of the cookie to use for sessions. This can be whatever you want (as long as it’s different from the other cookie names in your application).</p> </div> <div class="section" id="s-session-cookie-path"> <span id="s-std:setting-SESSION_COOKIE_PATH"></span><span id="session-cookie-path"></span><span id="std:setting-SESSION_COOKIE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_PATH</span></code><a class="headerlink" href="#session-cookie-path" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'/'</span></code></p> <p>The path set on the session cookie. This should either match the URL path of your Django installation or be parent of that path.</p> <p>This is useful if you have multiple Django instances running under the same hostname. They can use different cookie paths, and each instance will only see its own session cookie.</p> </div> <div class="section" id="s-session-cookie-samesite"> <span id="s-std:setting-SESSION_COOKIE_SAMESITE"></span><span id="session-cookie-samesite"></span><span id="std:setting-SESSION_COOKIE_SAMESITE"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_SAMESITE</span></code><a class="headerlink" href="#session-cookie-samesite" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'Lax'</span></code></p> <p>The value of the <a class="reference external" href="https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Set-Cookie/SameSite">SameSite</a> flag on the session cookie. This flag prevents the cookie from being sent in cross-site requests thus preventing CSRF attacks and making some methods of stealing session cookie impossible.</p> <p>Possible values for the setting are:</p> <ul> <li><p class="first"><code class="docutils literal notranslate"><span class="pre">'Strict'</span></code>: prevents the cookie from being sent by the browser to the target site in all cross-site browsing context, even when following a regular link.</p> <p>For example, for a GitHub-like website this would mean that if a logged-in user follows a link to a private GitHub project posted on a corporate discussion forum or email, GitHub will not receive the session cookie and the user won’t be able to access the project. A bank website, however, most likely doesn’t want to allow any transactional pages to be linked from external sites so the <code class="docutils literal notranslate"><span class="pre">'Strict'</span></code> flag would be appropriate.</p> </li> <li><p class="first"><code class="docutils literal notranslate"><span class="pre">'Lax'</span></code> (default): provides a balance between security and usability for websites that want to maintain user’s logged-in session after the user arrives from an external link.</p> <p>In the GitHub scenario, the session cookie would be allowed when following a regular link from an external website and be blocked in CSRF-prone request methods (e.g. <code class="docutils literal notranslate"><span class="pre">POST</span></code>).</p> </li> <li><p class="first"><code class="docutils literal notranslate"><span class="pre">None</span></code>: disables the flag.</p> </li> </ul> </div> <div class="section" id="s-session-cookie-secure"> <span id="s-std:setting-SESSION_COOKIE_SECURE"></span><span id="session-cookie-secure"></span><span id="std:setting-SESSION_COOKIE_SECURE"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_SECURE</span></code><a class="headerlink" href="#session-cookie-secure" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to use a secure cookie for the session cookie. If this is set to <code class="docutils literal notranslate"><span class="pre">True</span></code>, the cookie will be marked as “secure”, which means browsers may ensure that the cookie is only sent under an HTTPS connection.</p> <p>Leaving this setting off isn’t a good idea because an attacker could capture an unencrypted session cookie with a packet sniffer and use the cookie to hijack the user’s session.</p> </div> <div class="section" id="s-session-engine"> <span id="s-std:setting-SESSION_ENGINE"></span><span id="session-engine"></span><span id="std:setting-SESSION_ENGINE"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_ENGINE</span></code><a class="headerlink" href="#session-engine" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.db'</span></code></p> <p>Controls where Django stores session data. Included engines are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.db'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.file'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.cache'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.cached_db'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.backends.signed_cookies'</span></code></li> </ul> <p>See <a class="reference internal" href="../../topics/http/sessions/#configuring-sessions"><span class="std std-ref">Configuring the session engine</span></a> for more details.</p> </div> <div class="section" id="s-session-expire-at-browser-close"> <span id="s-std:setting-SESSION_EXPIRE_AT_BROWSER_CLOSE"></span><span id="session-expire-at-browser-close"></span><span id="std:setting-SESSION_EXPIRE_AT_BROWSER_CLOSE"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_EXPIRE_AT_BROWSER_CLOSE</span></code><a class="headerlink" href="#session-expire-at-browser-close" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to expire the session when the user closes their browser. See <a class="reference internal" href="../../topics/http/sessions/#browser-length-vs-persistent-sessions"><span class="std std-ref">Browser-length sessions vs. persistent sessions</span></a>.</p> </div> <div class="section" id="s-session-file-path"> <span id="s-std:setting-SESSION_FILE_PATH"></span><span id="session-file-path"></span><span id="std:setting-SESSION_FILE_PATH"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_FILE_PATH</span></code><a class="headerlink" href="#session-file-path" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>If you’re using file-based session storage, this sets the directory in which Django will store session data. When the default value (<code class="docutils literal notranslate"><span class="pre">None</span></code>) is used, Django will use the standard temporary directory for the system.</p> </div> <div class="section" id="s-session-save-every-request"> <span id="s-std:setting-SESSION_SAVE_EVERY_REQUEST"></span><span id="session-save-every-request"></span><span id="std:setting-SESSION_SAVE_EVERY_REQUEST"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_SAVE_EVERY_REQUEST</span></code><a class="headerlink" href="#session-save-every-request" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">False</span></code></p> <p>Whether to save the session data on every request. If this is <code class="docutils literal notranslate"><span class="pre">False</span></code> (default), then the session data will only be saved if it has been modified – that is, if any of its dictionary values have been assigned or deleted. Empty sessions won’t be created, even if this setting is active.</p> </div> <div class="section" id="s-session-serializer"> <span id="s-std:setting-SESSION_SERIALIZER"></span><span id="session-serializer"></span><span id="std:setting-SESSION_SERIALIZER"></span><h3><code class="docutils literal notranslate"><span class="pre">SESSION_SERIALIZER</span></code><a class="headerlink" href="#session-serializer" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.serializers.JSONSerializer'</span></code></p> <p>Full import path of a serializer class to use for serializing session data. Included serializers are:</p> <ul class="simple"> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.serializers.PickleSerializer'</span></code></li> <li><code class="docutils literal notranslate"><span class="pre">'django.contrib.sessions.serializers.JSONSerializer'</span></code></li> </ul> <p>See <a class="reference internal" href="../../topics/http/sessions/#session-serialization"><span class="std std-ref">Session serialization</span></a> for details, including a warning regarding possible remote code execution when using <a class="reference internal" href="../../topics/http/sessions/#django.contrib.sessions.serializers.PickleSerializer" title="django.contrib.sessions.serializers.PickleSerializer"><code class="xref py py-class docutils literal notranslate"><span class="pre">PickleSerializer</span></code></a>.</p> </div> </div> <div class="section" id="s-sites"> <span id="sites"></span><h2><a class="toc-backref" href="#id16">Sites</a><a class="headerlink" href="#sites" title="Permalink to this headline">¶</a></h2> <p>Settings for <a class="reference internal" href="../contrib/sites/#module-django.contrib.sites" title="django.contrib.sites: Lets you operate multiple websites from the same database and Django project"><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.sites</span></code></a>.</p> <div class="section" id="s-site-id"> <span id="s-std:setting-SITE_ID"></span><span id="site-id"></span><span id="std:setting-SITE_ID"></span><h3><code class="docutils literal notranslate"><span class="pre">SITE_ID</span></code><a class="headerlink" href="#site-id" title="Permalink to this headline">¶</a></h3> <p>Default: Not defined</p> <p>The ID, as an integer, of the current site in the <code class="docutils literal notranslate"><span class="pre">django_site</span></code> database table. This is used so that application data can hook into specific sites and a single database can manage content for multiple sites.</p> </div> </div> <div class="section" id="s-static-files"> <span id="s-settings-staticfiles"></span><span id="static-files"></span><span id="settings-staticfiles"></span><h2><a class="toc-backref" href="#id17">Static Files</a><a class="headerlink" href="#static-files" title="Permalink to this headline">¶</a></h2> <p>Settings for <a class="reference internal" href="../contrib/staticfiles/#module-django.contrib.staticfiles" title="django.contrib.staticfiles: An app for handling static files."><code class="xref py py-mod docutils literal notranslate"><span class="pre">django.contrib.staticfiles</span></code></a>.</p> <div class="section" id="s-static-root"> <span id="s-std:setting-STATIC_ROOT"></span><span id="static-root"></span><span id="std:setting-STATIC_ROOT"></span><h3><code class="docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code><a class="headerlink" href="#static-root" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>The absolute path to the directory where <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> will collect static files for deployment.</p> <p>Example: <code class="docutils literal notranslate"><span class="pre">"/var/www/example.com/static/"</span></code></p> <p>If the <a class="reference internal" href="../contrib/staticfiles/"><span class="doc">staticfiles</span></a> contrib app is enabled (as in the default project template), the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> management command will collect static files into this directory. See the how-to on <a class="reference internal" href="../../howto/static-files/"><span class="doc">managing static files</span></a> for more details about usage.</p> <div class="admonition warning"> <p class="first admonition-title">Warning</p> <p class="last">This should be an initially empty destination directory for collecting your static files from their permanent locations into one directory for ease of deployment; it is <strong>not</strong> a place to store your static files permanently. You should do that in directories that will be found by <a class="reference internal" href="../contrib/staticfiles/"><span class="doc">staticfiles</span></a>’s <a class="reference internal" href="#std:setting-STATICFILES_FINDERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">finders</span></code></a>, which by default, are <code class="docutils literal notranslate"><span class="pre">'static/'</span></code> app sub-directories and any directories you include in <a class="reference internal" href="#std:setting-STATICFILES_DIRS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATICFILES_DIRS</span></code></a>).</p> </div> </div> <div class="section" id="s-static-url"> <span id="s-std:setting-STATIC_URL"></span><span id="static-url"></span><span id="std:setting-STATIC_URL"></span><h3><code class="docutils literal notranslate"><span class="pre">STATIC_URL</span></code><a class="headerlink" href="#static-url" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">None</span></code></p> <p>URL to use when referring to static files located in <a class="reference internal" href="#std:setting-STATIC_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a>.</p> <p>Example: <code class="docutils literal notranslate"><span class="pre">"/static/"</span></code> or <code class="docutils literal notranslate"><span class="pre">"http://static.example.com/"</span></code></p> <p>If not <code class="docutils literal notranslate"><span class="pre">None</span></code>, this will be used as the base path for <a class="reference internal" href="../../topics/forms/media/#form-asset-paths"><span class="std std-ref">asset definitions</span></a> (the <code class="docutils literal notranslate"><span class="pre">Media</span></code> class) and the <a class="reference internal" href="../contrib/staticfiles/"><span class="doc">staticfiles app</span></a>.</p> <p>It must end in a slash if set to a non-empty value.</p> <p>You may need to <a class="reference internal" href="../../howto/static-files/#serving-static-files-in-development"><span class="std std-ref">configure these files to be served in development</span></a> and will definitely need to do so <a class="reference internal" href="../../howto/static-files/deployment/"><span class="doc">in production</span></a>.</p> </div> <div class="section" id="s-staticfiles-dirs"> <span id="s-std:setting-STATICFILES_DIRS"></span><span id="staticfiles-dirs"></span><span id="std:setting-STATICFILES_DIRS"></span><h3><code class="docutils literal notranslate"><span class="pre">STATICFILES_DIRS</span></code><a class="headerlink" href="#staticfiles-dirs" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">[]</span></code> (Empty list)</p> <p>This setting defines the additional locations the staticfiles app will traverse if the <code class="docutils literal notranslate"><span class="pre">FileSystemFinder</span></code> finder is enabled, e.g. if you use the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> or <a class="reference internal" href="../contrib/staticfiles/#django-admin-findstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">findstatic</span></code></a> management command or use the static file serving view.</p> <p>This should be set to a list of strings that contain full paths to your additional files directory(ies) e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">STATICFILES_DIRS</span> <span class="o">=</span> <span class="p">[</span> <span class="s2">"/home/special.polls.com/polls/static"</span><span class="p">,</span> <span class="s2">"/home/polls.com/polls/static"</span><span class="p">,</span> <span class="s2">"/opt/webfiles/common"</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> <p>Note that these paths should use Unix-style forward slashes, even on Windows (e.g. <code class="docutils literal notranslate"><span class="pre">"C:/Users/user/mysite/extra_static_content"</span></code>).</p> <div class="section" id="s-prefixes-optional"> <span id="s-staticfiles-dirs-prefixes"></span><span id="prefixes-optional"></span><span id="staticfiles-dirs-prefixes"></span><h4>Prefixes (optional)<a class="headerlink" href="#prefixes-optional" title="Permalink to this headline">¶</a></h4> <p>In case you want to refer to files in one of the locations with an additional namespace, you can <strong>optionally</strong> provide a prefix as <code class="docutils literal notranslate"><span class="pre">(prefix,</span> <span class="pre">path)</span></code> tuples, e.g.:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="n">STATICFILES_DIRS</span> <span class="o">=</span> <span class="p">[</span> <span class="c1"># ...</span> <span class="p">(</span><span class="s2">"downloads"</span><span class="p">,</span> <span class="s2">"/opt/webfiles/stats"</span><span class="p">),</span> <span class="p">]</span> </pre></div> </div> <p>For example, assuming you have <a class="reference internal" href="#std:setting-STATIC_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_URL</span></code></a> set to <code class="docutils literal notranslate"><span class="pre">'/static/'</span></code>, the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> management command would collect the “stats” files in a <code class="docutils literal notranslate"><span class="pre">'downloads'</span></code> subdirectory of <a class="reference internal" href="#std:setting-STATIC_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a>.</p> <p>This would allow you to refer to the local file <code class="docutils literal notranslate"><span class="pre">'/opt/webfiles/stats/polls_20101022.tar.gz'</span></code> with <code class="docutils literal notranslate"><span class="pre">'/static/downloads/polls_20101022.tar.gz'</span></code> in your templates, e.g.:</p> <div class="highlight-html+django notranslate"><div class="highlight"><pre><span></span><span class="p"><</span><span class="nt">a</span> <span class="na">href</span><span class="o">=</span><span class="s">"</span><span class="cp">{%</span> <span class="k">static</span> <span class="s2">"downloads/polls_20101022.tar.gz"</span> <span class="cp">%}</span><span class="s">"</span><span class="p">></span> </pre></div> </div> </div> </div> <div class="section" id="s-staticfiles-storage"> <span id="s-std:setting-STATICFILES_STORAGE"></span><span id="staticfiles-storage"></span><span id="std:setting-STATICFILES_STORAGE"></span><h3><code class="docutils literal notranslate"><span class="pre">STATICFILES_STORAGE</span></code><a class="headerlink" href="#staticfiles-storage" title="Permalink to this headline">¶</a></h3> <p>Default: <code class="docutils literal notranslate"><span class="pre">'django.contrib.staticfiles.storage.StaticFilesStorage'</span></code></p> <p>The file storage engine to use when collecting static files with the <a class="reference internal" href="../contrib/staticfiles/#django-admin-collectstatic"><code class="xref std std-djadmin docutils literal notranslate"><span class="pre">collectstatic</span></code></a> management command.</p> <p>A ready-to-use instance of the storage backend defined in this setting can be found at <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles.storage.staticfiles_storage</span></code>.</p> <p>For an example, see <a class="reference internal" href="../../howto/static-files/deployment/#staticfiles-from-cdn"><span class="std std-ref">Serving static files from a cloud service or CDN</span></a>.</p> </div> <div class="section" id="s-staticfiles-finders"> <span id="s-std:setting-STATICFILES_FINDERS"></span><span id="staticfiles-finders"></span><span id="std:setting-STATICFILES_FINDERS"></span><h3><code class="docutils literal notranslate"><span class="pre">STATICFILES_FINDERS</span></code><a class="headerlink" href="#staticfiles-finders" title="Permalink to this headline">¶</a></h3> <p>Default:</p> <div class="highlight-default notranslate"><div class="highlight"><pre><span></span><span class="p">[</span> <span class="s1">'django.contrib.staticfiles.finders.FileSystemFinder'</span><span class="p">,</span> <span class="s1">'django.contrib.staticfiles.finders.AppDirectoriesFinder'</span><span class="p">,</span> <span class="p">]</span> </pre></div> </div> <p>The list of finder backends that know how to find static files in various locations.</p> <p>The default will find files stored in the <a class="reference internal" href="#std:setting-STATICFILES_DIRS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATICFILES_DIRS</span></code></a> setting (using <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles.finders.FileSystemFinder</span></code>) and in a <code class="docutils literal notranslate"><span class="pre">static</span></code> subdirectory of each app (using <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles.finders.AppDirectoriesFinder</span></code>). If multiple files with the same name are present, the first file that is found will be used.</p> <p>One finder is disabled by default: <code class="docutils literal notranslate"><span class="pre">django.contrib.staticfiles.finders.DefaultStorageFinder</span></code>. If added to your <a class="reference internal" href="#std:setting-STATICFILES_FINDERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">STATICFILES_FINDERS</span></code></a> setting, it will look for static files in the default file storage as defined by the <a class="reference internal" href="#std:setting-DEFAULT_FILE_STORAGE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_FILE_STORAGE</span></code></a> setting.</p> <div class="admonition note"> <p class="first admonition-title">Note</p> <p class="last">When using the <code class="docutils literal notranslate"><span class="pre">AppDirectoriesFinder</span></code> finder, make sure your apps can be found by staticfiles by adding the app to the <a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a> setting of your site.</p> </div> <p>Static file finders are currently considered a private interface, and this interface is thus undocumented.</p> </div> </div> <div class="section" id="s-core-settings-topical-index"> <span id="core-settings-topical-index"></span><h2><a class="toc-backref" href="#id18">Core Settings Topical Index</a><a class="headerlink" href="#core-settings-topical-index" title="Permalink to this headline">¶</a></h2> <div class="section" id="s-cache"> <span id="cache"></span><h3>Cache<a class="headerlink" href="#cache" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-CACHES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CACHES</span></code></a></li> <li><a class="reference internal" href="#std:setting-CACHE_MIDDLEWARE_ALIAS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_ALIAS</span></code></a></li> <li><a class="reference internal" href="#std:setting-CACHE_MIDDLEWARE_KEY_PREFIX"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_KEY_PREFIX</span></code></a></li> <li><a class="reference internal" href="#std:setting-CACHE_MIDDLEWARE_SECONDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_SECONDS</span></code></a></li> </ul> </div> <div class="section" id="s-database"> <span id="database"></span><h3>Database<a class="headerlink" href="#database" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DATABASES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATABASES</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATABASE_ROUTERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATABASE_ROUTERS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEFAULT_INDEX_TABLESPACE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_INDEX_TABLESPACE</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEFAULT_TABLESPACE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_TABLESPACE</span></code></a></li> </ul> </div> <div class="section" id="s-debugging"> <span id="debugging"></span><h3>Debugging<a class="headerlink" href="#debugging" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DEBUG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEBUG_PROPAGATE_EXCEPTIONS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEBUG_PROPAGATE_EXCEPTIONS</span></code></a></li> </ul> </div> <div class="section" id="s-email"> <span id="email"></span><h3>Email<a class="headerlink" href="#email" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-ADMINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ADMINS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEFAULT_CHARSET"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_CHARSET</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEFAULT_FROM_EMAIL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_FROM_EMAIL</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_BACKEND"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_BACKEND</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_FILE_PATH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_FILE_PATH</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_HOST_PASSWORD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST_PASSWORD</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_HOST_USER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_HOST_USER</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_PORT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_PORT</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_SSL_CERTFILE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_SSL_CERTFILE</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_SSL_KEYFILE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_SSL_KEYFILE</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_SUBJECT_PREFIX"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_SUBJECT_PREFIX</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_TIMEOUT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_TIMEOUT</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_USE_LOCALTIME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_LOCALTIME</span></code></a></li> <li><a class="reference internal" href="#std:setting-EMAIL_USE_TLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a></li> <li><a class="reference internal" href="#std:setting-MANAGERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MANAGERS</span></code></a></li> <li><a class="reference internal" href="#std:setting-SERVER_EMAIL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SERVER_EMAIL</span></code></a></li> </ul> </div> <div class="section" id="s-error-reporting"> <span id="error-reporting"></span><h3>Error reporting<a class="headerlink" href="#error-reporting" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DEFAULT_EXCEPTION_REPORTER_FILTER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_EXCEPTION_REPORTER_FILTER</span></code></a></li> <li><a class="reference internal" href="#std:setting-IGNORABLE_404_URLS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">IGNORABLE_404_URLS</span></code></a></li> <li><a class="reference internal" href="#std:setting-MANAGERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MANAGERS</span></code></a></li> <li><a class="reference internal" href="#std:setting-SILENCED_SYSTEM_CHECKS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SILENCED_SYSTEM_CHECKS</span></code></a></li> </ul> </div> <div class="section" id="s-file-uploads"> <span id="s-file-upload-settings"></span><span id="file-uploads"></span><span id="file-upload-settings"></span><h3>File uploads<a class="headerlink" href="#file-uploads" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DEFAULT_FILE_STORAGE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_FILE_STORAGE</span></code></a></li> <li><a class="reference internal" href="#std:setting-FILE_UPLOAD_HANDLERS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_HANDLERS</span></code></a></li> <li><a class="reference internal" href="#std:setting-FILE_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_MAX_MEMORY_SIZE</span></code></a></li> <li><a class="reference internal" href="#std:setting-FILE_UPLOAD_PERMISSIONS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_PERMISSIONS</span></code></a></li> <li><a class="reference internal" href="#std:setting-FILE_UPLOAD_TEMP_DIR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FILE_UPLOAD_TEMP_DIR</span></code></a></li> <li><a class="reference internal" href="#std:setting-MEDIA_ROOT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a></li> <li><a class="reference internal" href="#std:setting-MEDIA_URL"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MEDIA_URL</span></code></a></li> </ul> </div> <div class="section" id="s-forms"> <span id="forms"></span><h3>Forms<a class="headerlink" href="#forms" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-FORM_RENDERER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FORM_RENDERER</span></code></a></li> </ul> </div> <div class="section" id="s-globalization-i18n-l10n"> <span id="globalization-i18n-l10n"></span><h3>Globalization (<code class="docutils literal notranslate"><span class="pre">i18n</span></code>/<code class="docutils literal notranslate"><span class="pre">l10n</span></code>)<a class="headerlink" href="#globalization-i18n-l10n" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATE_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATETIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DECIMAL_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#std:setting-FIRST_DAY_OF_WEEK"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FIRST_DAY_OF_WEEK</span></code></a></li> <li><a class="reference internal" href="#std:setting-FORMAT_MODULE_PATH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FORMAT_MODULE_PATH</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_CODE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_AGE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_AGE</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_DOMAIN"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_DOMAIN</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_HTTPONLY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_HTTPONLY</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_NAME</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_PATH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_PATH</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_SAMESITE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SAMESITE</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGE_COOKIE_SECURE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SECURE</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGES</span></code></a></li> <li><a class="reference internal" href="#std:setting-LANGUAGES_BIDI"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LANGUAGES_BIDI</span></code></a></li> <li><a class="reference internal" href="#std:setting-LOCALE_PATHS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOCALE_PATHS</span></code></a></li> <li><a class="reference internal" href="#std:setting-MONTH_DAY_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MONTH_DAY_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-NUMBER_GROUPING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a></li> <li><a class="reference internal" href="#std:setting-SHORT_DATE_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-SHORT_DATETIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_INPUT_FORMATS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_ZONE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_I18N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_I18N</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_L10N"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_L10N</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_THOUSAND_SEPARATOR"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_TZ"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_TZ</span></code></a></li> <li><a class="reference internal" href="#std:setting-YEAR_MONTH_FORMAT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">YEAR_MONTH_FORMAT</span></code></a></li> </ul> </div> <div class="section" id="s-http"> <span id="http"></span><h3>HTTP<a class="headerlink" href="#http" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DATA_UPLOAD_MAX_MEMORY_SIZE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATA_UPLOAD_MAX_MEMORY_SIZE</span></code></a></li> <li><a class="reference internal" href="#std:setting-DATA_UPLOAD_MAX_NUMBER_FIELDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DATA_UPLOAD_MAX_NUMBER_FIELDS</span></code></a></li> <li><a class="reference internal" href="#std:setting-DEFAULT_CHARSET"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_CHARSET</span></code></a></li> <li><a class="reference internal" href="#std:setting-DISALLOWED_USER_AGENTS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DISALLOWED_USER_AGENTS</span></code></a></li> <li><a class="reference internal" href="#std:setting-FORCE_SCRIPT_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FORCE_SCRIPT_NAME</span></code></a></li> <li><a class="reference internal" href="#std:setting-INTERNAL_IPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INTERNAL_IPS</span></code></a></li> <li><a class="reference internal" href="#std:setting-MIDDLEWARE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a></li> <li>Security<ul> <li><a class="reference internal" href="#std:setting-SECURE_BROWSER_XSS_FILTER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_BROWSER_XSS_FILTER</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_CONTENT_TYPE_NOSNIFF"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_CONTENT_TYPE_NOSNIFF</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_HSTS_INCLUDE_SUBDOMAINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_INCLUDE_SUBDOMAINS</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_HSTS_PRELOAD"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_PRELOAD</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_HSTS_SECONDS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_PROXY_SSL_HEADER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_PROXY_SSL_HEADER</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_REDIRECT_EXEMPT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_REDIRECT_EXEMPT</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_REFERRER_POLICY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_REFERRER_POLICY</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_SSL_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_SSL_HOST</span></code></a></li> <li><a class="reference internal" href="#std:setting-SECURE_SSL_REDIRECT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECURE_SSL_REDIRECT</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#std:setting-SIGNING_BACKEND"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SIGNING_BACKEND</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_X_FORWARDED_HOST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_HOST</span></code></a></li> <li><a class="reference internal" href="#std:setting-USE_X_FORWARDED_PORT"><code class="xref std std-setting docutils literal notranslate"><span class="pre">USE_X_FORWARDED_PORT</span></code></a></li> <li><a class="reference internal" href="#std:setting-WSGI_APPLICATION"><code class="xref std std-setting docutils literal notranslate"><span class="pre">WSGI_APPLICATION</span></code></a></li> </ul> </div> <div class="section" id="s-id10"> <span id="id10"></span><h3>Logging<a class="headerlink" href="#id10" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-LOGGING"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGGING</span></code></a></li> <li><a class="reference internal" href="#std:setting-LOGGING_CONFIG"><code class="xref std std-setting docutils literal notranslate"><span class="pre">LOGGING_CONFIG</span></code></a></li> </ul> </div> <div class="section" id="s-models"> <span id="models"></span><h3>Models<a class="headerlink" href="#models" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-ABSOLUTE_URL_OVERRIDES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ABSOLUTE_URL_OVERRIDES</span></code></a></li> <li><a class="reference internal" href="#std:setting-FIXTURE_DIRS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">FIXTURE_DIRS</span></code></a></li> <li><a class="reference internal" href="#std:setting-INSTALLED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a></li> </ul> </div> <div class="section" id="s-security"> <span id="security"></span><h3>Security<a class="headerlink" href="#security" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Cross Site Request Forgery Protection<ul> <li><a class="reference internal" href="#std:setting-CSRF_COOKIE_DOMAIN"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_COOKIE_DOMAIN</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_COOKIE_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_COOKIE_NAME</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_COOKIE_PATH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_COOKIE_PATH</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_COOKIE_SAMESITE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_COOKIE_SAMESITE</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_COOKIE_SECURE"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_COOKIE_SECURE</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_FAILURE_VIEW"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_FAILURE_VIEW</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_HEADER_NAME"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_HEADER_NAME</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_TRUSTED_ORIGINS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_TRUSTED_ORIGINS</span></code></a></li> <li><a class="reference internal" href="#std:setting-CSRF_USE_SESSIONS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">CSRF_USE_SESSIONS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#std:setting-SECRET_KEY"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a></li> <li><a class="reference internal" href="#std:setting-X_FRAME_OPTIONS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">X_FRAME_OPTIONS</span></code></a></li> </ul> </div> <div class="section" id="s-serialization"> <span id="serialization"></span><h3>Serialization<a class="headerlink" href="#serialization" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-DEFAULT_CHARSET"><code class="xref std std-setting docutils literal notranslate"><span class="pre">DEFAULT_CHARSET</span></code></a></li> <li><a class="reference internal" href="#std:setting-SERIALIZATION_MODULES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">SERIALIZATION_MODULES</span></code></a></li> </ul> </div> <div class="section" id="s-id11"> <span id="id11"></span><h3>Templates<a class="headerlink" href="#id11" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-TEMPLATES"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEMPLATES</span></code></a></li> </ul> </div> <div class="section" id="s-testing"> <span id="testing"></span><h3>Testing<a class="headerlink" href="#testing" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li>Database: <a class="reference internal" href="#std:setting-DATABASE-TEST"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEST</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEST_NON_SERIALIZED_APPS"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEST_NON_SERIALIZED_APPS</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEST_RUNNER"><code class="xref std std-setting docutils literal notranslate"><span class="pre">TEST_RUNNER</span></code></a></li> </ul> </div> <div class="section" id="s-urls"> <span id="urls"></span><h3>URLs<a class="headerlink" href="#urls" title="Permalink to this headline">¶</a></h3> <ul class="simple"> <li><a class="reference internal" href="#std:setting-APPEND_SLASH"><code class="xref std std-setting docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code></a></li> <li><a class="reference internal" href="#std:setting-PREPEND_WWW"><code class="xref std std-setting docutils literal notranslate"><span class="pre">PREPEND_WWW</span></code></a></li> <li><a class="reference internal" href="#std:setting-ROOT_URLCONF"><code class="xref std std-setting docutils literal notranslate"><span class="pre">ROOT_URLCONF</span></code></a></li> </ul> </div> </div> </div> </div> <div class="browse-horizontal"> <div class="left"><a rel="prev" href="../schema-editor/"><i class="icon icon-chevron-left"></i> <code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code></a></div> <div class="right"><a rel="next" href="../signals/">Signals <i class="icon icon-chevron-right"></i></a></div> </div> <a href="#top" class="backtotop"><i class="icon icon-chevron-up"></i> Back to Top</a> </div> <h1 class="visuallyhidden">Additional Information</h1> <div role="complementary"> <div class="fundraising-sidebar"> <h2>Support Django!</h2> <div class="small-heart"> <img src="https://static.djangoproject.com/img/fundraising-heart.cd6bb84ffd33.svg" alt="Support Django!" /> </div> <div class="small-cta"> <ul class="list-links-small"> <li><a href="https://www.djangoproject.com/fundraising/"> Ramana Varanasi donated to the Django Software Foundation to support Django development. Donate today! </a></li> </ul> </div> </div> <h2>Contents</h2> <ul> <li><a class="reference internal" href="#">Settings</a><ul> <li><a class="reference internal" href="#core-settings">Core Settings</a><ul> <li><a class="reference internal" href="#absolute-url-overrides"><code class="docutils literal notranslate"><span class="pre">ABSOLUTE_URL_OVERRIDES</span></code></a></li> <li><a class="reference internal" href="#admins"><code class="docutils literal notranslate"><span class="pre">ADMINS</span></code></a></li> <li><a class="reference internal" href="#allowed-hosts"><code class="docutils literal notranslate"><span class="pre">ALLOWED_HOSTS</span></code></a></li> <li><a class="reference internal" href="#append-slash"><code class="docutils literal notranslate"><span class="pre">APPEND_SLASH</span></code></a></li> <li><a class="reference internal" href="#caches"><code class="docutils literal notranslate"><span class="pre">CACHES</span></code></a><ul> <li><a class="reference internal" href="#backend"><code class="docutils literal notranslate"><span class="pre">BACKEND</span></code></a></li> <li><a class="reference internal" href="#key-function"><code class="docutils literal notranslate"><span class="pre">KEY_FUNCTION</span></code></a></li> <li><a class="reference internal" href="#key-prefix"><code class="docutils literal notranslate"><span class="pre">KEY_PREFIX</span></code></a></li> <li><a class="reference internal" href="#location"><code class="docutils literal notranslate"><span class="pre">LOCATION</span></code></a></li> <li><a class="reference internal" href="#options"><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code></a></li> <li><a class="reference internal" href="#timeout"><code class="docutils literal notranslate"><span class="pre">TIMEOUT</span></code></a></li> <li><a class="reference internal" href="#version"><code class="docutils literal notranslate"><span class="pre">VERSION</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#cache-middleware-alias"><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_ALIAS</span></code></a></li> <li><a class="reference internal" href="#cache-middleware-key-prefix"><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_KEY_PREFIX</span></code></a></li> <li><a class="reference internal" href="#cache-middleware-seconds"><code class="docutils literal notranslate"><span class="pre">CACHE_MIDDLEWARE_SECONDS</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-age"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_AGE</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-domain"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_DOMAIN</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-httponly"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_HTTPONLY</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-name"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_NAME</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-path"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_PATH</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-samesite"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_SAMESITE</span></code></a></li> <li><a class="reference internal" href="#csrf-cookie-secure"><code class="docutils literal notranslate"><span class="pre">CSRF_COOKIE_SECURE</span></code></a></li> <li><a class="reference internal" href="#csrf-use-sessions"><code class="docutils literal notranslate"><span class="pre">CSRF_USE_SESSIONS</span></code></a></li> <li><a class="reference internal" href="#csrf-failure-view"><code class="docutils literal notranslate"><span class="pre">CSRF_FAILURE_VIEW</span></code></a></li> <li><a class="reference internal" href="#csrf-header-name"><code class="docutils literal notranslate"><span class="pre">CSRF_HEADER_NAME</span></code></a></li> <li><a class="reference internal" href="#csrf-trusted-origins"><code class="docutils literal notranslate"><span class="pre">CSRF_TRUSTED_ORIGINS</span></code></a></li> <li><a class="reference internal" href="#databases"><code class="docutils literal notranslate"><span class="pre">DATABASES</span></code></a><ul> <li><a class="reference internal" href="#atomic-requests"><code class="docutils literal notranslate"><span class="pre">ATOMIC_REQUESTS</span></code></a></li> <li><a class="reference internal" href="#autocommit"><code class="docutils literal notranslate"><span class="pre">AUTOCOMMIT</span></code></a></li> <li><a class="reference internal" href="#engine"><code class="docutils literal notranslate"><span class="pre">ENGINE</span></code></a></li> <li><a class="reference internal" href="#host"><code class="docutils literal notranslate"><span class="pre">HOST</span></code></a></li> <li><a class="reference internal" href="#name"><code class="docutils literal notranslate"><span class="pre">NAME</span></code></a></li> <li><a class="reference internal" href="#conn-max-age"><code class="docutils literal notranslate"><span class="pre">CONN_MAX_AGE</span></code></a></li> <li><a class="reference internal" href="#std:setting-OPTIONS"><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code></a></li> <li><a class="reference internal" href="#password"><code class="docutils literal notranslate"><span class="pre">PASSWORD</span></code></a></li> <li><a class="reference internal" href="#port"><code class="docutils literal notranslate"><span class="pre">PORT</span></code></a></li> <li><a class="reference internal" href="#time-zone"><code class="docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a></li> <li><a class="reference internal" href="#disable-server-side-cursors"><code class="docutils literal notranslate"><span class="pre">DISABLE_SERVER_SIDE_CURSORS</span></code></a></li> <li><a class="reference internal" href="#user"><code class="docutils literal notranslate"><span class="pre">USER</span></code></a></li> <li><a class="reference internal" href="#test"><code class="docutils literal notranslate"><span class="pre">TEST</span></code></a><ul> <li><a class="reference internal" href="#charset"><code class="docutils literal notranslate"><span class="pre">CHARSET</span></code></a></li> <li><a class="reference internal" href="#collation"><code class="docutils literal notranslate"><span class="pre">COLLATION</span></code></a></li> <li><a class="reference internal" href="#dependencies"><code class="docutils literal notranslate"><span class="pre">DEPENDENCIES</span></code></a></li> <li><a class="reference internal" href="#mirror"><code class="docutils literal notranslate"><span class="pre">MIRROR</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEST_NAME"><code class="docutils literal notranslate"><span class="pre">NAME</span></code></a></li> <li><a class="reference internal" href="#serialize"><code class="docutils literal notranslate"><span class="pre">SERIALIZE</span></code></a></li> <li><a class="reference internal" href="#template"><code class="docutils literal notranslate"><span class="pre">TEMPLATE</span></code></a></li> <li><a class="reference internal" href="#create-db"><code class="docutils literal notranslate"><span class="pre">CREATE_DB</span></code></a></li> <li><a class="reference internal" href="#create-user"><code class="docutils literal notranslate"><span class="pre">CREATE_USER</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEST_USER"><code class="docutils literal notranslate"><span class="pre">USER</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEST_PASSWD"><code class="docutils literal notranslate"><span class="pre">PASSWORD</span></code></a></li> <li><a class="reference internal" href="#oracle-managed-files"><code class="docutils literal notranslate"><span class="pre">ORACLE_MANAGED_FILES</span></code></a></li> <li><a class="reference internal" href="#tblspace"><code class="docutils literal notranslate"><span class="pre">TBLSPACE</span></code></a></li> <li><a class="reference internal" href="#tblspace-tmp"><code class="docutils literal notranslate"><span class="pre">TBLSPACE_TMP</span></code></a></li> <li><a class="reference internal" href="#datafile"><code class="docutils literal notranslate"><span class="pre">DATAFILE</span></code></a></li> <li><a class="reference internal" href="#datafile-tmp"><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP</span></code></a></li> <li><a class="reference internal" href="#datafile-maxsize"><code class="docutils literal notranslate"><span class="pre">DATAFILE_MAXSIZE</span></code></a></li> <li><a class="reference internal" href="#datafile-tmp-maxsize"><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_MAXSIZE</span></code></a></li> <li><a class="reference internal" href="#datafile-size"><code class="docutils literal notranslate"><span class="pre">DATAFILE_SIZE</span></code></a></li> <li><a class="reference internal" href="#datafile-tmp-size"><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_SIZE</span></code></a></li> <li><a class="reference internal" href="#datafile-extsize"><code class="docutils literal notranslate"><span class="pre">DATAFILE_EXTSIZE</span></code></a></li> <li><a class="reference internal" href="#datafile-tmp-extsize"><code class="docutils literal notranslate"><span class="pre">DATAFILE_TMP_EXTSIZE</span></code></a></li> </ul> </li> </ul> </li> <li><a class="reference internal" href="#data-upload-max-memory-size">DATA_UPLOAD_MAX_MEMORY_SIZE</a></li> <li><a class="reference internal" href="#data-upload-max-number-fields">DATA_UPLOAD_MAX_NUMBER_FIELDS</a></li> <li><a class="reference internal" href="#database-routers"><code class="docutils literal notranslate"><span class="pre">DATABASE_ROUTERS</span></code></a></li> <li><a class="reference internal" href="#date-format"><code class="docutils literal notranslate"><span class="pre">DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#date-input-formats"><code class="docutils literal notranslate"><span class="pre">DATE_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#datetime-format"><code class="docutils literal notranslate"><span class="pre">DATETIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#datetime-input-formats"><code class="docutils literal notranslate"><span class="pre">DATETIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#debug"><code class="docutils literal notranslate"><span class="pre">DEBUG</span></code></a></li> <li><a class="reference internal" href="#debug-propagate-exceptions"><code class="docutils literal notranslate"><span class="pre">DEBUG_PROPAGATE_EXCEPTIONS</span></code></a></li> <li><a class="reference internal" href="#decimal-separator"><code class="docutils literal notranslate"><span class="pre">DECIMAL_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#default-charset"><code class="docutils literal notranslate"><span class="pre">DEFAULT_CHARSET</span></code></a></li> <li><a class="reference internal" href="#default-exception-reporter-filter"><code class="docutils literal notranslate"><span class="pre">DEFAULT_EXCEPTION_REPORTER_FILTER</span></code></a></li> <li><a class="reference internal" href="#default-file-storage"><code class="docutils literal notranslate"><span class="pre">DEFAULT_FILE_STORAGE</span></code></a></li> <li><a class="reference internal" href="#default-from-email"><code class="docutils literal notranslate"><span class="pre">DEFAULT_FROM_EMAIL</span></code></a></li> <li><a class="reference internal" href="#default-index-tablespace"><code class="docutils literal notranslate"><span class="pre">DEFAULT_INDEX_TABLESPACE</span></code></a></li> <li><a class="reference internal" href="#default-tablespace"><code class="docutils literal notranslate"><span class="pre">DEFAULT_TABLESPACE</span></code></a></li> <li><a class="reference internal" href="#disallowed-user-agents"><code class="docutils literal notranslate"><span class="pre">DISALLOWED_USER_AGENTS</span></code></a></li> <li><a class="reference internal" href="#email-backend"><code class="docutils literal notranslate"><span class="pre">EMAIL_BACKEND</span></code></a></li> <li><a class="reference internal" href="#email-file-path"><code class="docutils literal notranslate"><span class="pre">EMAIL_FILE_PATH</span></code></a></li> <li><a class="reference internal" href="#email-host"><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST</span></code></a></li> <li><a class="reference internal" href="#email-host-password"><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST_PASSWORD</span></code></a></li> <li><a class="reference internal" href="#email-host-user"><code class="docutils literal notranslate"><span class="pre">EMAIL_HOST_USER</span></code></a></li> <li><a class="reference internal" href="#email-port"><code class="docutils literal notranslate"><span class="pre">EMAIL_PORT</span></code></a></li> <li><a class="reference internal" href="#email-subject-prefix"><code class="docutils literal notranslate"><span class="pre">EMAIL_SUBJECT_PREFIX</span></code></a></li> <li><a class="reference internal" href="#email-use-localtime"><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_LOCALTIME</span></code></a></li> <li><a class="reference internal" href="#email-use-tls"><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_TLS</span></code></a></li> <li><a class="reference internal" href="#email-use-ssl"><code class="docutils literal notranslate"><span class="pre">EMAIL_USE_SSL</span></code></a></li> <li><a class="reference internal" href="#email-ssl-certfile"><code class="docutils literal notranslate"><span class="pre">EMAIL_SSL_CERTFILE</span></code></a></li> <li><a class="reference internal" href="#email-ssl-keyfile"><code class="docutils literal notranslate"><span class="pre">EMAIL_SSL_KEYFILE</span></code></a></li> <li><a class="reference internal" href="#email-timeout"><code class="docutils literal notranslate"><span class="pre">EMAIL_TIMEOUT</span></code></a></li> <li><a class="reference internal" href="#file-charset"><code class="docutils literal notranslate"><span class="pre">FILE_CHARSET</span></code></a></li> <li><a class="reference internal" href="#file-upload-handlers"><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_HANDLERS</span></code></a></li> <li><a class="reference internal" href="#file-upload-max-memory-size"><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_MAX_MEMORY_SIZE</span></code></a></li> <li><a class="reference internal" href="#file-upload-directory-permissions"><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_DIRECTORY_PERMISSIONS</span></code></a></li> <li><a class="reference internal" href="#file-upload-permissions"><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_PERMISSIONS</span></code></a></li> <li><a class="reference internal" href="#file-upload-temp-dir"><code class="docutils literal notranslate"><span class="pre">FILE_UPLOAD_TEMP_DIR</span></code></a></li> <li><a class="reference internal" href="#first-day-of-week"><code class="docutils literal notranslate"><span class="pre">FIRST_DAY_OF_WEEK</span></code></a></li> <li><a class="reference internal" href="#fixture-dirs"><code class="docutils literal notranslate"><span class="pre">FIXTURE_DIRS</span></code></a></li> <li><a class="reference internal" href="#force-script-name"><code class="docutils literal notranslate"><span class="pre">FORCE_SCRIPT_NAME</span></code></a></li> <li><a class="reference internal" href="#form-renderer"><code class="docutils literal notranslate"><span class="pre">FORM_RENDERER</span></code></a></li> <li><a class="reference internal" href="#format-module-path"><code class="docutils literal notranslate"><span class="pre">FORMAT_MODULE_PATH</span></code></a></li> <li><a class="reference internal" href="#ignorable-404-urls"><code class="docutils literal notranslate"><span class="pre">IGNORABLE_404_URLS</span></code></a></li> <li><a class="reference internal" href="#installed-apps"><code class="docutils literal notranslate"><span class="pre">INSTALLED_APPS</span></code></a></li> <li><a class="reference internal" href="#internal-ips"><code class="docutils literal notranslate"><span class="pre">INTERNAL_IPS</span></code></a></li> <li><a class="reference internal" href="#language-code"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_CODE</span></code></a></li> <li><a class="reference internal" href="#language-cookie-age"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_AGE</span></code></a></li> <li><a class="reference internal" href="#language-cookie-domain"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_DOMAIN</span></code></a></li> <li><a class="reference internal" href="#language-cookie-httponly"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_HTTPONLY</span></code></a></li> <li><a class="reference internal" href="#language-cookie-name"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_NAME</span></code></a></li> <li><a class="reference internal" href="#language-cookie-path"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_PATH</span></code></a></li> <li><a class="reference internal" href="#language-cookie-samesite"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SAMESITE</span></code></a></li> <li><a class="reference internal" href="#language-cookie-secure"><code class="docutils literal notranslate"><span class="pre">LANGUAGE_COOKIE_SECURE</span></code></a></li> <li><a class="reference internal" href="#languages"><code class="docutils literal notranslate"><span class="pre">LANGUAGES</span></code></a></li> <li><a class="reference internal" href="#languages-bidi"><code class="docutils literal notranslate"><span class="pre">LANGUAGES_BIDI</span></code></a></li> <li><a class="reference internal" href="#locale-paths"><code class="docutils literal notranslate"><span class="pre">LOCALE_PATHS</span></code></a></li> <li><a class="reference internal" href="#logging"><code class="docutils literal notranslate"><span class="pre">LOGGING</span></code></a></li> <li><a class="reference internal" href="#logging-config"><code class="docutils literal notranslate"><span class="pre">LOGGING_CONFIG</span></code></a></li> <li><a class="reference internal" href="#managers"><code class="docutils literal notranslate"><span class="pre">MANAGERS</span></code></a></li> <li><a class="reference internal" href="#media-root"><code class="docutils literal notranslate"><span class="pre">MEDIA_ROOT</span></code></a></li> <li><a class="reference internal" href="#media-url"><code class="docutils literal notranslate"><span class="pre">MEDIA_URL</span></code></a></li> <li><a class="reference internal" href="#middleware"><code class="docutils literal notranslate"><span class="pre">MIDDLEWARE</span></code></a></li> <li><a class="reference internal" href="#migration-modules"><code class="docutils literal notranslate"><span class="pre">MIGRATION_MODULES</span></code></a></li> <li><a class="reference internal" href="#month-day-format"><code class="docutils literal notranslate"><span class="pre">MONTH_DAY_FORMAT</span></code></a></li> <li><a class="reference internal" href="#number-grouping"><code class="docutils literal notranslate"><span class="pre">NUMBER_GROUPING</span></code></a></li> <li><a class="reference internal" href="#prepend-www"><code class="docutils literal notranslate"><span class="pre">PREPEND_WWW</span></code></a></li> <li><a class="reference internal" href="#root-urlconf"><code class="docutils literal notranslate"><span class="pre">ROOT_URLCONF</span></code></a></li> <li><a class="reference internal" href="#secret-key"><code class="docutils literal notranslate"><span class="pre">SECRET_KEY</span></code></a></li> <li><a class="reference internal" href="#secure-browser-xss-filter"><code class="docutils literal notranslate"><span class="pre">SECURE_BROWSER_XSS_FILTER</span></code></a></li> <li><a class="reference internal" href="#secure-content-type-nosniff"><code class="docutils literal notranslate"><span class="pre">SECURE_CONTENT_TYPE_NOSNIFF</span></code></a></li> <li><a class="reference internal" href="#secure-hsts-include-subdomains"><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_INCLUDE_SUBDOMAINS</span></code></a></li> <li><a class="reference internal" href="#secure-hsts-preload"><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_PRELOAD</span></code></a></li> <li><a class="reference internal" href="#secure-hsts-seconds"><code class="docutils literal notranslate"><span class="pre">SECURE_HSTS_SECONDS</span></code></a></li> <li><a class="reference internal" href="#secure-proxy-ssl-header"><code class="docutils literal notranslate"><span class="pre">SECURE_PROXY_SSL_HEADER</span></code></a></li> <li><a class="reference internal" href="#secure-redirect-exempt"><code class="docutils literal notranslate"><span class="pre">SECURE_REDIRECT_EXEMPT</span></code></a></li> <li><a class="reference internal" href="#secure-referrer-policy"><code class="docutils literal notranslate"><span class="pre">SECURE_REFERRER_POLICY</span></code></a></li> <li><a class="reference internal" href="#secure-ssl-host"><code class="docutils literal notranslate"><span class="pre">SECURE_SSL_HOST</span></code></a></li> <li><a class="reference internal" href="#secure-ssl-redirect"><code class="docutils literal notranslate"><span class="pre">SECURE_SSL_REDIRECT</span></code></a></li> <li><a class="reference internal" href="#serialization-modules"><code class="docutils literal notranslate"><span class="pre">SERIALIZATION_MODULES</span></code></a></li> <li><a class="reference internal" href="#server-email"><code class="docutils literal notranslate"><span class="pre">SERVER_EMAIL</span></code></a></li> <li><a class="reference internal" href="#short-date-format"><code class="docutils literal notranslate"><span class="pre">SHORT_DATE_FORMAT</span></code></a></li> <li><a class="reference internal" href="#short-datetime-format"><code class="docutils literal notranslate"><span class="pre">SHORT_DATETIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#signing-backend"><code class="docutils literal notranslate"><span class="pre">SIGNING_BACKEND</span></code></a></li> <li><a class="reference internal" href="#silenced-system-checks"><code class="docutils literal notranslate"><span class="pre">SILENCED_SYSTEM_CHECKS</span></code></a></li> <li><a class="reference internal" href="#templates"><code class="docutils literal notranslate"><span class="pre">TEMPLATES</span></code></a><ul> <li><a class="reference internal" href="#std:setting-TEMPLATES-BACKEND"><code class="docutils literal notranslate"><span class="pre">BACKEND</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEMPLATES-NAME"><code class="docutils literal notranslate"><span class="pre">NAME</span></code></a></li> <li><a class="reference internal" href="#dirs"><code class="docutils literal notranslate"><span class="pre">DIRS</span></code></a></li> <li><a class="reference internal" href="#app-dirs"><code class="docutils literal notranslate"><span class="pre">APP_DIRS</span></code></a></li> <li><a class="reference internal" href="#std:setting-TEMPLATES-OPTIONS"><code class="docutils literal notranslate"><span class="pre">OPTIONS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#test-runner"><code class="docutils literal notranslate"><span class="pre">TEST_RUNNER</span></code></a></li> <li><a class="reference internal" href="#test-non-serialized-apps"><code class="docutils literal notranslate"><span class="pre">TEST_NON_SERIALIZED_APPS</span></code></a></li> <li><a class="reference internal" href="#thousand-separator"><code class="docutils literal notranslate"><span class="pre">THOUSAND_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#time-format"><code class="docutils literal notranslate"><span class="pre">TIME_FORMAT</span></code></a></li> <li><a class="reference internal" href="#time-input-formats"><code class="docutils literal notranslate"><span class="pre">TIME_INPUT_FORMATS</span></code></a></li> <li><a class="reference internal" href="#std:setting-TIME_ZONE"><code class="docutils literal notranslate"><span class="pre">TIME_ZONE</span></code></a></li> <li><a class="reference internal" href="#use-i18n"><code class="docutils literal notranslate"><span class="pre">USE_I18N</span></code></a></li> <li><a class="reference internal" href="#use-l10n"><code class="docutils literal notranslate"><span class="pre">USE_L10N</span></code></a></li> <li><a class="reference internal" href="#use-thousand-separator"><code class="docutils literal notranslate"><span class="pre">USE_THOUSAND_SEPARATOR</span></code></a></li> <li><a class="reference internal" href="#use-tz"><code class="docutils literal notranslate"><span class="pre">USE_TZ</span></code></a></li> <li><a class="reference internal" href="#use-x-forwarded-host"><code class="docutils literal notranslate"><span class="pre">USE_X_FORWARDED_HOST</span></code></a></li> <li><a class="reference internal" href="#use-x-forwarded-port"><code class="docutils literal notranslate"><span class="pre">USE_X_FORWARDED_PORT</span></code></a></li> <li><a class="reference internal" href="#wsgi-application"><code class="docutils literal notranslate"><span class="pre">WSGI_APPLICATION</span></code></a></li> <li><a class="reference internal" href="#year-month-format"><code class="docutils literal notranslate"><span class="pre">YEAR_MONTH_FORMAT</span></code></a></li> <li><a class="reference internal" href="#x-frame-options"><code class="docutils literal notranslate"><span class="pre">X_FRAME_OPTIONS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#auth">Auth</a><ul> <li><a class="reference internal" href="#authentication-backends"><code class="docutils literal notranslate"><span class="pre">AUTHENTICATION_BACKENDS</span></code></a></li> <li><a class="reference internal" href="#auth-user-model"><code class="docutils literal notranslate"><span class="pre">AUTH_USER_MODEL</span></code></a></li> <li><a class="reference internal" href="#login-redirect-url"><code class="docutils literal notranslate"><span class="pre">LOGIN_REDIRECT_URL</span></code></a></li> <li><a class="reference internal" href="#login-url"><code class="docutils literal notranslate"><span class="pre">LOGIN_URL</span></code></a></li> <li><a class="reference internal" href="#logout-redirect-url"><code class="docutils literal notranslate"><span class="pre">LOGOUT_REDIRECT_URL</span></code></a></li> <li><a class="reference internal" href="#password-reset-timeout-days"><code class="docutils literal notranslate"><span class="pre">PASSWORD_RESET_TIMEOUT_DAYS</span></code></a></li> <li><a class="reference internal" href="#password-hashers"><code class="docutils literal notranslate"><span class="pre">PASSWORD_HASHERS</span></code></a></li> <li><a class="reference internal" href="#auth-password-validators"><code class="docutils literal notranslate"><span class="pre">AUTH_PASSWORD_VALIDATORS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#messages">Messages</a><ul> <li><a class="reference internal" href="#message-level"><code class="docutils literal notranslate"><span class="pre">MESSAGE_LEVEL</span></code></a></li> <li><a class="reference internal" href="#message-storage"><code class="docutils literal notranslate"><span class="pre">MESSAGE_STORAGE</span></code></a></li> <li><a class="reference internal" href="#message-tags"><code class="docutils literal notranslate"><span class="pre">MESSAGE_TAGS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#sessions">Sessions</a><ul> <li><a class="reference internal" href="#session-cache-alias"><code class="docutils literal notranslate"><span class="pre">SESSION_CACHE_ALIAS</span></code></a></li> <li><a class="reference internal" href="#session-cookie-age"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_AGE</span></code></a></li> <li><a class="reference internal" href="#session-cookie-domain"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_DOMAIN</span></code></a></li> <li><a class="reference internal" href="#session-cookie-httponly"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_HTTPONLY</span></code></a></li> <li><a class="reference internal" href="#session-cookie-name"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_NAME</span></code></a></li> <li><a class="reference internal" href="#session-cookie-path"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_PATH</span></code></a></li> <li><a class="reference internal" href="#session-cookie-samesite"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_SAMESITE</span></code></a></li> <li><a class="reference internal" href="#session-cookie-secure"><code class="docutils literal notranslate"><span class="pre">SESSION_COOKIE_SECURE</span></code></a></li> <li><a class="reference internal" href="#session-engine"><code class="docutils literal notranslate"><span class="pre">SESSION_ENGINE</span></code></a></li> <li><a class="reference internal" href="#session-expire-at-browser-close"><code class="docutils literal notranslate"><span class="pre">SESSION_EXPIRE_AT_BROWSER_CLOSE</span></code></a></li> <li><a class="reference internal" href="#session-file-path"><code class="docutils literal notranslate"><span class="pre">SESSION_FILE_PATH</span></code></a></li> <li><a class="reference internal" href="#session-save-every-request"><code class="docutils literal notranslate"><span class="pre">SESSION_SAVE_EVERY_REQUEST</span></code></a></li> <li><a class="reference internal" href="#session-serializer"><code class="docutils literal notranslate"><span class="pre">SESSION_SERIALIZER</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#sites">Sites</a><ul> <li><a class="reference internal" href="#site-id"><code class="docutils literal notranslate"><span class="pre">SITE_ID</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#static-files">Static Files</a><ul> <li><a class="reference internal" href="#static-root"><code class="docutils literal notranslate"><span class="pre">STATIC_ROOT</span></code></a></li> <li><a class="reference internal" href="#static-url"><code class="docutils literal notranslate"><span class="pre">STATIC_URL</span></code></a></li> <li><a class="reference internal" href="#staticfiles-dirs"><code class="docutils literal notranslate"><span class="pre">STATICFILES_DIRS</span></code></a><ul> <li><a class="reference internal" href="#prefixes-optional">Prefixes (optional)</a></li> </ul> </li> <li><a class="reference internal" href="#staticfiles-storage"><code class="docutils literal notranslate"><span class="pre">STATICFILES_STORAGE</span></code></a></li> <li><a class="reference internal" href="#staticfiles-finders"><code class="docutils literal notranslate"><span class="pre">STATICFILES_FINDERS</span></code></a></li> </ul> </li> <li><a class="reference internal" href="#core-settings-topical-index">Core Settings Topical Index</a><ul> <li><a class="reference internal" href="#cache">Cache</a></li> <li><a class="reference internal" href="#database">Database</a></li> <li><a class="reference internal" href="#debugging">Debugging</a></li> <li><a class="reference internal" href="#email">Email</a></li> <li><a class="reference internal" href="#error-reporting">Error reporting</a></li> <li><a class="reference internal" href="#file-uploads">File uploads</a></li> <li><a class="reference internal" href="#forms">Forms</a></li> <li><a class="reference internal" href="#globalization-i18n-l10n">Globalization (<code class="docutils literal notranslate"><span class="pre">i18n</span></code>/<code class="docutils literal notranslate"><span class="pre">l10n</span></code>)</a></li> <li><a class="reference internal" href="#http">HTTP</a></li> <li><a class="reference internal" href="#id10">Logging</a></li> <li><a class="reference internal" href="#models">Models</a></li> <li><a class="reference internal" href="#security">Security</a></li> <li><a class="reference internal" href="#serialization">Serialization</a></li> <li><a class="reference internal" href="#id11">Templates</a></li> <li><a class="reference internal" href="#testing">Testing</a></li> <li><a class="reference internal" href="#urls">URLs</a></li> </ul> </li> </ul> </li> </ul> <h2>Browse</h2> <ul> <li>Prev: <a rel="prev" href="../schema-editor/"><code class="docutils literal notranslate"><span class="pre">SchemaEditor</span></code></a></li> <li>Next: <a rel="next" href="../signals/">Signals</a></li> <li><a href="https://docs.djangoproject.com/en/3.0/contents/">Table of contents</a></li> <li><a href="https://docs.djangoproject.com/en/3.0/genindex/">General Index</a></li> <li><a href="https://docs.djangoproject.com/en/3.0/py-modindex/">Python Module Index</a></li> </ul> <h2>You are here:</h2> <ul> <li> <a href="https://docs.djangoproject.com/en/3.0/">Django 3.0 documentation</a> <ul><li><a href="../">API Reference</a> <ul><li>Settings</li></ul> </li></ul> </li> </ul> <h2 id="getting-help-sidebar">Getting help</h2> <dl class="list-links"> <dt><a href="https://docs.djangoproject.com/en/3.0/faq/">FAQ</a></dt> <dd>Try the FAQ — it's got answers to many common questions.</dd> <dt><a href="/en/stable/genindex/">Index</a>, <a href="/en/stable/py-modindex/">Module Index</a>, or <a href="/en/stable/contents/">Table of Contents</a></dt> <dd>Handy when looking for specific information.</dd> <dt><a href="https://groups.google.com/group/django-users/">django-users mailing list</a></dt> <dd>Search for information in the archives of the django-users mailing list, or post a question.</dd> <dt><a href="irc://irc.libera.chat/django">#django IRC channel</a></dt> <dd>Ask a question in the #django IRC channel, or search the IRC logs to see if it’s been asked before.</dd> <dt><a href="https://discord.gg/xcRH6mN4fa">Django Discord Server</a></dt> <dd>Join the Django Discord Community.</dd> <dt><a href="https://forum.djangoproject.com/">Official Django Forum</a></dt> <dd>Join the community on the Django Forum.</dd> <dt><a href="https://code.djangoproject.com/">Ticket tracker</a></dt> <dd>Report bugs with Django or Django documentation in our ticket tracker.</dd> </dl> <h2>Download:</h2> <p> Offline (Django 3.0): <a href="https://media.djangoproject.com/docs/django-docs-3.0-en.zip">HTML</a> | <a href="https://media.readthedocs.org/pdf/django/3.0.x/django.pdf">PDF</a> | <a href="https://media.readthedocs.org/epub/django/3.0.x/django.epub">ePub</a> <br> <span class="quiet"> Provided by <a href="https://readthedocs.org/">Read the Docs</a>. </span> </p> </div> </div> <!-- SVGs --> <svg xmlns="http://www.w3.org/2000/svg"> <symbol viewBox="0 0 24 24" id="icon-auto"><path d="M0 0h24v24H0z" fill="currentColor"/><path d="M12 22C6.477 22 2 17.523 2 12S6.477 2 12 2s10 4.477 10 10-4.477 10-10 10zm0-2V4a8 8 0 1 0 0 16z"/></symbol> <symbol viewBox="0 0 24 24" id="icon-moon"><path d="M0 0h24v24H0z" fill="currentColor"/><path d="M10 7a7 7 0 0 0 12 4.9v.1c0 5.523-4.477 10-10 10S2 17.523 2 12 6.477 2 12 2h.1A6.979 6.979 0 0 0 10 7zm-6 5a8 8 0 0 0 15.062 3.762A9 9 0 0 1 8.238 4.938 7.999 7.999 0 0 0 4 12z"/></symbol> <symbol viewBox="0 0 24 24" id="icon-sun"><path d="M0 0h24v24H0z" fill="currentColor"/><path d="M12 18a6 6 0 1 1 0-12 6 6 0 0 1 0 12zm0-2a4 4 0 1 0 0-8 4 4 0 0 0 0 8zM11 1h2v3h-2V1zm0 19h2v3h-2v-3zM3.515 4.929l1.414-1.414L7.05 5.636 5.636 7.05 3.515 4.93zM16.95 18.364l1.414-1.414 2.121 2.121-1.414 1.414-2.121-2.121zm2.121-14.85l1.414 1.415-2.121 2.121-1.414-1.414 2.121-2.121zM5.636 16.95l1.414 1.414-2.121 2.121-1.414-1.414 2.121-2.121zM23 11v2h-3v-2h3zM4 11v2H1v-2h3z"/></symbol> </svg> <!-- END SVGs --> <div role="contentinfo"> <div class="subfooter"> <div class="container"> <h1 class="visuallyhidden">Django Links</h1> <div class="column-container"> <div class="col-learn-more"> <h2>Learn More</h2> <ul> <li><a href="https://www.djangoproject.com/start/overview/">About Django</a></li> <li><a href="https://www.djangoproject.com/start/">Getting Started with Django</a></li> <li><a href="https://docs.djangoproject.com/en/dev/internals/organization/">Team Organization</a></li> <li><a href="https://www.djangoproject.com/foundation/">Django Software Foundation</a></li> <li><a href="https://www.djangoproject.com/conduct/">Code of Conduct</a></li> <li><a href="https://www.djangoproject.com/diversity/">Diversity Statement</a></li> </ul> </div> <div class="col-get-involved"> <h2>Get Involved</h2> <ul> <li><a href="https://www.djangoproject.com/community/">Join a Group</a></li> <li><a href="https://docs.djangoproject.com/en/dev/internals/contributing/">Contribute to Django</a></li> <li><a href="https://docs.djangoproject.com/en/dev/internals/contributing/bugs-and-features/">Submit a Bug</a></li> <li><a href="https://docs.djangoproject.com/en/dev/internals/security/#reporting-security-issues">Report a Security Issue</a></li> <li><a href="https://www.djangoproject.com/foundation/individual-members/">Individual membership</a></li> </ul> </div> <div class="col-get-help"> <h2>Get Help</h2> <ul> <li><a href="https://docs.djangoproject.com/en/stable/faq/">Getting Help FAQ</a> </li> <li><a href="irc://irc.libera.chat/django">#django IRC channel</a></li> <li><a href="https://discord.gg/xcRH6mN4fa" target="_blank">Django Discord</a></li> <li><a href="https://forum.djangoproject.com/" target="_blank">Official Django Forum</a></li> </ul> </div> <div class="col-follow-us"> <h2>Follow Us</h2> <ul> <li><a href="https://github.com/django">GitHub</a></li> <li><a href="https://twitter.com/djangoproject">Twitter</a></li> <li><a href="https://fosstodon.org/@django" rel="me">Fediverse (Mastodon)</a></li> <li><a href="https://www.djangoproject.com/rss/weblog/">News RSS</a></li> <li><a href="https://groups.google.com/forum/#!forum/django-users">Django Users Mailing List</a></li> </ul> </div> <div class="col-support-us"> <h2>Support Us</h2> <ul> <li><a href="https://www.djangoproject.com/fundraising/">Sponsor Django</a></li> <li><a href="/foundation/corporate-membership/">Corporate membership</a></li> <li><a href="https://django.threadless.com/" target="_blank">Official merchandise store</a></li> <li><a href="/foundation/donate/#benevity-giving">Benevity Workplace Giving Program</a></li> </ul> </div> </div> </div> </div> <div class="footer"> <div class="container"> <div class="footer-logo"> <a class="logo" href="https://www.djangoproject.com/">Django</a> </div> <ul class="thanks"> <li> <span>Hosting by</span> <a class="in-kind-donors" href="https://www.djangoproject.com/fundraising/#in-kind-donors">In-kind donors</a> </li> <li class="design"><span>Design by</span> <a class="threespot" href="https://www.threespot.com">Threespot</a> <span class="ampersand">&</span> <a class="andrevv" href="http://andrevv.com/">andrevv</a></li> </ul> <p class="copyright">© 2005-2024 <a href="https://www.djangoproject.com/foundation/"> Django Software Foundation</a> and individual contributors. Django is a <a href="https://www.djangoproject.com/trademarks/">registered trademark</a> of the Django Software Foundation. </p> </div> </div> </div> <script> function extless(input) { return input.replace(/(.*)\.[^.]+$/, '$1'); } var require = { shim: { 'jquery': [], 'jquery.inview': ["jquery"], 'jquery.payment': ["jquery"], 'jquery.flot': ["jquery"], 'jquery.unveil': ["jquery"], 'stripe': { exports: 'Stripe' } }, paths: { "jquery": extless("https://static.djangoproject.com/js/lib/jquery/dist/jquery.min.eb6af28969bd.js"), "jquery.inview": extless("https://static.djangoproject.com/js/lib/jquery.inview/jquery.inview.min.4edba1c65592.js"), "jquery.payment": extless("https://static.djangoproject.com/js/lib/jquery.payment/lib/jquery.payment.e99c05ca79ae.js"), "jquery.unveil": extless("https://static.djangoproject.com/js/lib/unveil/jquery.unveil.min.ac79eb277093.js"), "jquery.flot": extless("https://static.djangoproject.com/js/lib/jquery-flot/jquery.flot.min.9964206e9d7f.js"), "clipboard": extless("https://static.djangoproject.com/js/lib/clipboard/dist/clipboard.min.bd70fd596a23.js"), "mod/floating-warning": extless("https://static.djangoproject.com/js/mod/floating-warning.a21b2abd2884.js"), "mod/list-collapsing": extless("https://static.djangoproject.com/js/mod/list-collapsing.c1a08d3ef9e9.js"), "mod/list-feature": extless("https://static.djangoproject.com/js/mod/list-feature.73529480f25b.js"), "mod/mobile-menu": extless("https://static.djangoproject.com/js/mod/mobile-menu.8e7e063d3524.js"), "mod/version-switcher": extless("https://static.djangoproject.com/js/mod/version-switcher.c56ff7ed5481.js"), "mod/search-key": extless("https://static.djangoproject.com/js/mod/search-key.ae7292327b47.js"), "mod/stripe-change-card": extless("https://static.djangoproject.com/js/mod/stripe-change-card.682c710317a8.js"), "mod/switch-dark-mode": extless("https://static.djangoproject.com/js/mod/switch-dark-mode.69777ee87b91.js"), "mod/console-tabs": extless("https://static.djangoproject.com/js/mod/console-tabs.70ce882faaf3.js"), "stripe-checkout": "https://checkout.stripe.com/checkout", "stripe": "https://js.stripe.com/v3/?" // ? needed due to require.js } }; </script> <script data-main="https://static.djangoproject.com/js/main.48270eac7c0b.js" src="https://static.djangoproject.com/js/lib/require.177879fbe7dd.js"></script> <div id="outdated-warning" class="doc-floating-warning"> This document is for an insecure version of Django that is no longer supported. Please upgrade to a newer release! </div> </body> </html>