1375 | | .. setting:: SESSION_COOKIE_AGE |
1376 | | |
1377 | | SESSION_COOKIE_AGE |
1378 | | ------------------ |
1379 | | |
1380 | | Default: ``1209600`` (2 weeks, in seconds) |
1381 | | |
1382 | | The age of session cookies, in seconds. See :doc:`/topics/http/sessions`. |
1383 | | |
1384 | | .. setting:: SESSION_COOKIE_DOMAIN |
1385 | | |
1386 | | SESSION_COOKIE_DOMAIN |
1387 | | --------------------- |
1388 | | |
1389 | | Default: ``None`` |
1390 | | |
1391 | | The domain to use for session cookies. Set this to a string such as |
1392 | | ``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard |
1393 | | domain cookie. See the :doc:`/topics/http/sessions`. |
1394 | | |
1395 | | .. setting:: SESSION_COOKIE_HTTPONLY |
1396 | | |
1397 | | SESSION_COOKIE_HTTPONLY |
1398 | | ----------------------- |
1399 | | |
1400 | | Default: ``False`` |
1401 | | |
1402 | | Whether to use HTTPOnly flag on the session cookie. If this is set to |
1403 | | ``True``, client-side JavaScript will not to be able to access the |
1404 | | session cookie. |
1405 | | |
1406 | | HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It |
1407 | | is not part of the RFC2109 standard for cookies, and it isn't honored |
1408 | | consistently by all browsers. However, when it is honored, it can be a |
1409 | | useful way to mitigate the risk of client side script accessing the |
1410 | | protected cookie data. |
1411 | | |
1412 | | .. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly |
1413 | | |
1414 | | .. setting:: SESSION_COOKIE_NAME |
1415 | | |
1416 | | SESSION_COOKIE_NAME |
1417 | | ------------------- |
1418 | | |
1419 | | Default: ``'sessionid'`` |
1420 | | |
1421 | | The name of the cookie to use for sessions. This can be whatever you want (but |
1422 | | should be different from ``LANGUAGE_COOKIE_NAME``). See the :doc:`/topics/http/sessions`. |
1423 | | |
1424 | | .. setting:: SESSION_COOKIE_PATH |
1425 | | |
1426 | | SESSION_COOKIE_PATH |
1427 | | ------------------- |
1428 | | |
1429 | | .. versionadded:: 1.0 |
1430 | | |
1431 | | Default: ``'/'`` |
1432 | | |
1433 | | The path set on the session cookie. This should either match the URL path of your |
1434 | | Django installation or be parent of that path. |
1435 | | |
1436 | | This is useful if you have multiple Django instances running under the same |
1437 | | hostname. They can use different cookie paths, and each instance will only see |
1438 | | its own session cookie. |
1439 | | |
1440 | | .. setting:: SESSION_COOKIE_SECURE |
1441 | | |
1442 | | SESSION_COOKIE_SECURE |
1443 | | --------------------- |
1444 | | |
1445 | | Default: ``False`` |
1446 | | |
1447 | | Whether to use a secure cookie for the session cookie. If this is set to |
1448 | | ``True``, the cookie will be marked as "secure," which means browsers may |
1449 | | ensure that the cookie is only sent under an HTTPS connection. |
1450 | | See the :doc:`/topics/http/sessions`. |
1451 | | |
1452 | | .. setting:: SESSION_ENGINE |
1453 | | |
1454 | | SESSION_ENGINE |
1455 | | -------------- |
1456 | | |
1457 | | .. versionadded:: 1.0 |
1458 | | |
1459 | | .. versionchanged:: 1.1 |
1460 | | The ``cached_db`` backend was added |
1461 | | |
1462 | | Default: ``django.contrib.sessions.backends.db`` |
1463 | | |
1464 | | Controls where Django stores session data. Valid values are: |
1465 | | |
1466 | | * ``'django.contrib.sessions.backends.db'`` |
1467 | | * ``'django.contrib.sessions.backends.file'`` |
1468 | | * ``'django.contrib.sessions.backends.cache'`` |
1469 | | * ``'django.contrib.sessions.backends.cached_db'`` |
1470 | | |
1471 | | See :doc:`/topics/http/sessions`. |
1472 | | |
1473 | | .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE |
1474 | | |
1475 | | SESSION_EXPIRE_AT_BROWSER_CLOSE |
1476 | | ------------------------------- |
1477 | | |
1478 | | Default: ``False`` |
1479 | | |
1480 | | Whether to expire the session when the user closes his or her browser. |
1481 | | See the :doc:`/topics/http/sessions`. |
1482 | | |
1483 | | .. setting:: SESSION_FILE_PATH |
1484 | | |
1485 | | SESSION_FILE_PATH |
1486 | | ----------------- |
1487 | | |
1488 | | .. versionadded:: 1.0 |
1489 | | |
1490 | | Default: ``None`` |
1491 | | |
1492 | | If you're using file-based session storage, this sets the directory in |
1493 | | which Django will store session data. See :doc:`/topics/http/sessions`. When |
1494 | | the default value (``None``) is used, Django will use the standard temporary |
1495 | | directory for the system. |
1496 | | |
1497 | | .. setting:: SESSION_SAVE_EVERY_REQUEST |
1498 | | |
1499 | | SESSION_SAVE_EVERY_REQUEST |
1500 | | -------------------------- |
1501 | | |
1502 | | Default: ``False`` |
1503 | | |
1504 | | Whether to save the session data on every request. See |
1505 | | :doc:`/topics/http/sessions`. |
1506 | | |
| 1709 | |
| 1710 | Contrib settings |
| 1711 | ================ |
| 1712 | |
| 1713 | Settings provided by contrib apps are grouped by app below. |
| 1714 | |
| 1715 | Auth |
| 1716 | ---- |
| 1717 | |
| 1718 | Settings for :mod:`django.contrib.auth`. |
| 1719 | |
| 1720 | .. setting:: AUTHENTICATION_BACKENDS |
| 1721 | |
| 1722 | AUTHENTICATION_BACKENDS |
| 1723 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 1724 | |
| 1725 | Default: ``('django.contrib.auth.backends.ModelBackend',)`` |
| 1726 | |
| 1727 | A tuple of authentication backend classes (as strings) to use when attempting to |
| 1728 | authenticate a user. See the :doc:`authentication backends documentation |
| 1729 | </ref/authbackends>` for details. |
| 1730 | |
| 1731 | .. _settings-comments: |
| 1732 | |
| 1733 | Comments |
| 1734 | -------- |
| 1735 | |
| 1736 | Settings for :mod:`django.contrib.comments`. |
| 1737 | |
| 1738 | .. setting:: COMMENT_MAX_LENGTH |
| 1739 | |
| 1740 | COMMENT_MAX_LENGTH |
| 1741 | ~~~~~~~~~~~~~~~~~~ |
| 1742 | |
| 1743 | Default: ``3000`` (characters) |
| 1744 | |
| 1745 | The maximum length of the comment field, in characters. Comments longer than |
| 1746 | this will be rejected. |
| 1747 | |
| 1748 | .. setting:: COMMENTS_APP |
| 1749 | |
| 1750 | COMMENTS_APP |
| 1751 | ~~~~~~~~~~~~ |
| 1752 | |
| 1753 | An app which provides :doc:`customization of the comments framework |
| 1754 | </ref/contrib/comments/custom>`. Use the same dotted-string notation |
| 1755 | as in :setting:`INSTALLED_APPS`. Your custom :setting:`COMMENTS_APP` |
| 1756 | must also be listed in :setting:`INSTALLED_APPS`. |
| 1757 | |
| 1758 | .. setting:: COMMENTS_HIDE_REMOVED |
| 1759 | |
| 1760 | COMMENTS_HIDE_REMOVED |
| 1761 | ~~~~~~~~~~~~~~~~~~~~~ |
| 1762 | |
| 1763 | Default: ``True`` |
| 1764 | |
| 1765 | If ``True``, removed comments will be excluded from comment |
| 1766 | lists and counts (as taken from template tags). Otherwise, the template author |
| 1767 | isresponsible for some sort of a "this comment has been removed by the site |
| 1768 | staff" message. |
| 1769 | |
| 1770 | |
| 1771 | Markup |
| 1772 | ------ |
| 1773 | |
| 1774 | Settings for :mod:`django.contrib.markup`. |
| 1775 | |
| 1776 | .. setting:: RESTRUCTUREDTEXT_FILTER_SETTINGS |
| 1777 | |
| 1778 | RESTRUCTUREDTEXT_FILTER_SETTINGS |
| 1779 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1780 | |
| 1781 | Default: ``{}`` |
| 1782 | |
| 1783 | A dictionary containing settings for the ``restructuredtext`` markup filter from |
| 1784 | the :doc:`django.contrib.markup application </ref/contrib/markup>`. They override |
| 1785 | the default writer settings. See the Docutils restructuredtext `writer settings |
| 1786 | docs`_ for details. |
| 1787 | |
| 1788 | .. _writer settings docs: http://docutils.sourceforge.net/docs/user/config.html#html4css1-writer |
| 1789 | |
| 1790 | |
| 1791 | .. _settings-messages: |
| 1792 | |
| 1793 | Messages |
| 1794 | -------- |
| 1795 | |
| 1796 | Settings for :mod:`django.contrib.messages`. |
| 1797 | |
| 1798 | .. setting:: MESSAGE_LEVEL |
| 1799 | |
| 1800 | MESSAGE_LEVEL |
| 1801 | ~~~~~~~~~~~~~ |
| 1802 | |
| 1803 | Default: ``messages.INFO`` |
| 1804 | |
| 1805 | This sets the minimum message that will be saved in the message storage. See |
| 1806 | :ref:`message levels <message-level>` for more details. |
| 1807 | |
| 1808 | .. admonition:: Important |
| 1809 | |
| 1810 | If you override ``MESSAGE_LEVEL`` in your settings file and rely on any of |
| 1811 | the built-in constants, you must import the constants module directly to |
| 1812 | avoid the potential for circular imports, e.g.:: |
| 1813 | |
| 1814 | from django.contrib.messages import constants as message_constants |
| 1815 | MESSAGE_LEVEL = message_constants.DEBUG |
| 1816 | |
| 1817 | If desired, you may specify the numeric values for the constants directly |
| 1818 | according to the values in the :ref:`constants table |
| 1819 | <message-level-constants>`. |
| 1820 | |
| 1821 | .. setting:: MESSAGE_STORAGE |
| 1822 | |
| 1823 | MESSAGE_STORAGE |
| 1824 | ~~~~~~~~~~~~~~~ |
| 1825 | |
| 1826 | Default: ``'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'`` |
| 1827 | |
| 1828 | Controls where Django stores message data. Valid values are: |
| 1829 | |
| 1830 | * ``'django.contrib.messages.storage.fallback.FallbackStorage'`` |
| 1831 | * ``'django.contrib.messages.storage.session.SessionStorage'`` |
| 1832 | * ``'django.contrib.messages.storage.cookie.CookieStorage'`` |
| 1833 | * ``'django.contrib.messages.storage.user_messages.LegacyFallbackStorage'`` |
| 1834 | |
| 1835 | See :ref:`message storage backends <message-storage-backends>` for more details. |
| 1836 | |
| 1837 | .. setting:: MESSAGE_TAGS |
| 1838 | |
| 1839 | MESSAGE_TAGS |
| 1840 | ~~~~~~~~~~~~ |
| 1841 | |
| 1842 | Default:: |
| 1843 | |
| 1844 | {messages.DEBUG: 'debug', |
| 1845 | messages.INFO: 'info', |
| 1846 | messages.SUCCESS: 'success', |
| 1847 | messages.WARNING: 'warning', |
| 1848 | messages.ERROR: 'error',} |
| 1849 | |
| 1850 | This sets the mapping of message level to message tag, which is typically |
| 1851 | rendered as a CSS class in HTML. If you specify a value, it will extend |
| 1852 | the default. This means you only have to specify those values which you need |
| 1853 | to override. See :ref:`displaying messages <message-displaying>` for more details. |
| 1854 | |
| 1855 | .. admonition:: Important |
| 1856 | |
| 1857 | If you override ``MESSAGE_TAGS`` in your settings file and rely on any of |
| 1858 | the built-in constants, you must import the ``constants`` module directly to |
| 1859 | avoid the potential for circular imports, e.g.:: |
| 1860 | |
| 1861 | from django.contrib.messages import constants as message_constants |
| 1862 | MESSAGE_TAGS = {message_constants.INFO: ''} |
| 1863 | |
| 1864 | If desired, you may specify the numeric values for the constants directly |
| 1865 | according to the values in the above :ref:`constants table |
| 1866 | <message-level-constants>`. |
| 1867 | |
| 1868 | |
| 1869 | Sessions |
| 1870 | -------- |
| 1871 | |
| 1872 | Settings for :mod:`django.contrib.sessions`. |
| 1873 | |
| 1874 | .. setting:: SESSION_COOKIE_AGE |
| 1875 | |
| 1876 | SESSION_COOKIE_AGE |
| 1877 | ~~~~~~~~~~~~~~~~~~ |
| 1878 | |
| 1879 | Default: ``1209600`` (2 weeks, in seconds) |
| 1880 | |
| 1881 | The age of session cookies, in seconds. See :doc:`/topics/http/sessions`. |
| 1882 | |
| 1883 | .. setting:: SESSION_COOKIE_DOMAIN |
| 1884 | |
| 1885 | SESSION_COOKIE_DOMAIN |
| 1886 | ~~~~~~~~~~~~~~~~~~~~~ |
| 1887 | |
| 1888 | Default: ``None`` |
| 1889 | |
| 1890 | The domain to use for session cookies. Set this to a string such as |
| 1891 | ``".lawrence.com"`` for cross-domain cookies, or use ``None`` for a standard |
| 1892 | domain cookie. See the :doc:`/topics/http/sessions`. |
| 1893 | |
| 1894 | .. setting:: SESSION_COOKIE_HTTPONLY |
| 1895 | |
| 1896 | SESSION_COOKIE_HTTPONLY |
| 1897 | ~~~~~~~~~~~~~~~~~~~~~~~ |
| 1898 | |
| 1899 | Default: ``False`` |
| 1900 | |
| 1901 | Whether to use HTTPOnly flag on the session cookie. If this is set to |
| 1902 | ``True``, client-side JavaScript will not to be able to access the |
| 1903 | session cookie. |
| 1904 | |
| 1905 | HTTPOnly_ is a flag included in a Set-Cookie HTTP response header. It |
| 1906 | is not part of the RFC2109 standard for cookies, and it isn't honored |
| 1907 | consistently by all browsers. However, when it is honored, it can be a |
| 1908 | useful way to mitigate the risk of client side script accessing the |
| 1909 | protected cookie data. |
| 1910 | |
| 1911 | .. _HTTPOnly: http://www.owasp.org/index.php/HTTPOnly |
| 1912 | |
| 1913 | .. setting:: SESSION_COOKIE_NAME |
| 1914 | |
| 1915 | SESSION_COOKIE_NAME |
| 1916 | ~~~~~~~~~~~~~~~~~~~ |
| 1917 | |
| 1918 | Default: ``'sessionid'`` |
| 1919 | |
| 1920 | The name of the cookie to use for sessions. This can be whatever you want (but |
| 1921 | should be different from ``LANGUAGE_COOKIE_NAME``). See the :doc:`/topics/http/sessions`. |
| 1922 | |
| 1923 | .. setting:: SESSION_COOKIE_PATH |
| 1924 | |
| 1925 | SESSION_COOKIE_PATH |
| 1926 | ~~~~~~~~~~~~~~~~~~~ |
| 1927 | |
| 1928 | .. versionadded:: 1.0 |
| 1929 | |
| 1930 | Default: ``'/'`` |
| 1931 | |
| 1932 | The path set on the session cookie. This should either match the URL path of your |
| 1933 | Django installation or be parent of that path. |
| 1934 | |
| 1935 | This is useful if you have multiple Django instances running under the same |
| 1936 | hostname. They can use different cookie paths, and each instance will only see |
| 1937 | its own session cookie. |
| 1938 | |
| 1939 | .. setting:: SESSION_COOKIE_SECURE |
| 1940 | |
| 1941 | SESSION_COOKIE_SECURE |
| 1942 | ~~~~~~~~~~~~~~~~~~~~~ |
| 1943 | |
| 1944 | Default: ``False`` |
| 1945 | |
| 1946 | Whether to use a secure cookie for the session cookie. If this is set to |
| 1947 | ``True``, the cookie will be marked as "secure," which means browsers may |
| 1948 | ensure that the cookie is only sent under an HTTPS connection. |
| 1949 | See the :doc:`/topics/http/sessions`. |
| 1950 | |
| 1951 | .. setting:: SESSION_ENGINE |
| 1952 | |
| 1953 | SESSION_ENGINE |
| 1954 | ~~~~~~~~~~~~~~ |
| 1955 | |
| 1956 | .. versionadded:: 1.0 |
| 1957 | |
| 1958 | .. versionchanged:: 1.1 |
| 1959 | The ``cached_db`` backend was added |
| 1960 | |
| 1961 | Default: ``django.contrib.sessions.backends.db`` |
| 1962 | |
| 1963 | Controls where Django stores session data. Valid values are: |
| 1964 | |
| 1965 | * ``'django.contrib.sessions.backends.db'`` |
| 1966 | * ``'django.contrib.sessions.backends.file'`` |
| 1967 | * ``'django.contrib.sessions.backends.cache'`` |
| 1968 | * ``'django.contrib.sessions.backends.cached_db'`` |
| 1969 | |
| 1970 | See :doc:`/topics/http/sessions`. |
| 1971 | |
| 1972 | .. setting:: SESSION_EXPIRE_AT_BROWSER_CLOSE |
| 1973 | |
| 1974 | SESSION_EXPIRE_AT_BROWSER_CLOSE |
| 1975 | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 1976 | |
| 1977 | Default: ``False`` |
| 1978 | |
| 1979 | Whether to expire the session when the user closes his or her browser. |
| 1980 | See the :doc:`/topics/http/sessions`. |
| 1981 | |
| 1982 | .. setting:: SESSION_FILE_PATH |
| 1983 | |
| 1984 | SESSION_FILE_PATH |
| 1985 | ~~~~~~~~~~~~~~~~~ |
| 1986 | |
| 1987 | .. versionadded:: 1.0 |
| 1988 | |
| 1989 | Default: ``None`` |
| 1990 | |
| 1991 | If you're using file-based session storage, this sets the directory in |
| 1992 | which Django will store session data. See :doc:`/topics/http/sessions`. When |
| 1993 | the default value (``None``) is used, Django will use the standard temporary |
| 1994 | directory for the system. |
| 1995 | |
| 1996 | .. setting:: SESSION_SAVE_EVERY_REQUEST |
| 1997 | |
| 1998 | SESSION_SAVE_EVERY_REQUEST |
| 1999 | ~~~~~~~~~~~~~~~~~~~~~~~~~~ |
| 2000 | |
| 2001 | Default: ``False`` |
| 2002 | |
| 2003 | Whether to save the session data on every request. See |
| 2004 | :doc:`/topics/http/sessions`. |
| 2005 | |
| 2006 | Sites |
| 2007 | ----- |
| 2008 | |
| 2009 | Settings for :mod:`django.contrib.sites`. |
| 2010 | |
| 2011 | .. setting:: SITE_ID |
| 2012 | |
| 2013 | SITE_ID |
| 2014 | ~~~~~~~ |
| 2015 | |
| 2016 | Default: Not defined |
| 2017 | |
| 2018 | The ID, as an integer, of the current site in the ``django_site`` database |
| 2019 | table. This is used so that application data can hook into specific sites |
| 2020 | and a single database can manage content for multiple sites. |
| 2021 | |
| 2022 | |