diff --git a/.gitignore b/.gitignore
index 069a608..e4022af 100644
--- a/.gitignore
+++ b/.gitignore
@@ -6,4 +6,5 @@ build/
dist/
test.db
.tox
-.coverage
\ No newline at end of file
+.coverage
+docs/_build
diff --git a/LICENSE b/LICENSE
index e742c1d..f1915ae 100644
--- a/LICENSE
+++ b/LICENSE
@@ -1,4 +1,4 @@
-Copyright (c) 2009-2010, Comoga
+Copyright (c) 2009-2014, Comoga and individual contributors
All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
diff --git a/README.rst b/README.rst
index 7ba0f4a..6706fe1 100644
--- a/README.rst
+++ b/README.rst
@@ -1,291 +1,18 @@
Constance - Dynamic Django settings
===================================
-.. image:: https://secure.travis-ci.org/comoga/django-constance.png
+.. image:: https://secure.travis-ci.org/jezdez/django-constance.png
:alt: Build Status
- :target: http://travis-ci.org/comoga/django-constance
+ :target: http://travis-ci.org/jezdez/django-constance
-Features
---------
+A Django app for storing dynamic settings in pluggable backends (Redis and
+Django model backend built in) with an integration with the Django admin app.
-* Easily migrate your static settings to dynamic settings.
-* Admin interface to edit the dynamic settings.
+For more information see the documentation at:
-Installation
-------------
+ http://django-constance.readthedocs.org/
-Install from PyPI the backend specific variant of django-constance:
+If you have questions or have trouble using the app please file a bug report
+at:
-For the (default) Redis backend::
-
- pip install django-constance[redis]
-
-For the database backend::
-
- pip install django-constance[database]
-
-Alternatively -- if you're sure that the dependencies are already
-installed -- you can also run::
-
- pip install django-constance
-
-Or install the `in-development version`_ using ``pip``::
-
- pip install -e git+git://github.com/comoga/django-constance#egg=django-constance
-
-.. _`in-development version`: https://github.com/comoga/django-constance/tarball/master#egg=django-constance-dev
-
-Configuration
--------------
-
-Modify your ``settings.py``. Add ``'constance'`` to your ``INSTALLED_APPS``,
-and move each key you want to turn dynamic into the ``CONSTANCE_CONFIG``
-section, like this::
-
- INSTALLED_APPS = (
- ...
- 'constance',
- )
-
- CONSTANCE_CONFIG = {
- 'MY_SETTINGS_KEY': (42, 'the answer to everything'),
- }
-
-Here, ``42`` is the default value for the key ``MY_SETTINGS_KEY`` if it is
-not found in the backend. The other member of the tuple is a help text the
-admin will show.
-
-See the `Backends`_ section how to setup the backend.
-
-Backends
-~~~~~~~~
-
-Constance ships with a bunch of backends that are used to store the
-configuration values. By default it uses the Redis backend. To override
-the default please set the ``CONSTANCE_BACKEND`` setting to the appropriate
-dotted path.
-
-Redis (default)
-+++++++++++++++
-
-::
-
- CONSTANCE_BACKEND = 'constance.backends.redisd.RedisBackend'
-
-This is the default backend and has a couple of options:
-
-* ``CONSTANCE_REDIS_CONNECTION``
-
- A dictionary of parameters to pass to the to Redis client, e.g.::
-
- CONSTANCE_REDIS_CONNECTION = {
- 'host': 'localhost',
- 'port': 6379,
- 'db': 0,
- }
-
- Alternatively you can use a URL to do the same::
-
- CONSTANCE_REDIS_CONNECTION = 'redis://username:password@localhost:6379/0'
-
-* ``CONSTANCE_REDIS_CONNECTION_CLASS``
-
- An (optional) dotted import path to a connection to use, e.g.::
-
- CONSTANCE_REDIS_CONNECTION_CLASS = 'myproject.myapp.mockup.Connection'
-
- If you are using `django-redis `_,
- feel free to use the ``CONSTANCE_REDIS_CONNECTION_CLASS`` setting to define
- a callable that returns a redis connection, e.g.::
-
- CONSTANCE_REDIS_CONNECTION_CLASS = 'redis_cache.get_redis_connection'
-
-* ``CONSTANCE_REDIS_PREFIX``
-
- The (optional) prefix to be used for the key when storing in the Redis
- database. Defaults to ``'constance:'``. E.g.::
-
- CONSTANCE_REDIS_PREFIX = 'constance:myproject:'
-
-Database
-++++++++
-
-::
-
- CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
-
-If you want to use this backend you also need to add the database backend
-to your ``INSTALLED_APPS`` setting to make sure the data model is correctly
-created::
-
- INSTALLED_APPS = (
- # other apps
- 'constance.backends.database',
- )
-
-It also uses `django-picklefield`_ to store the values in the database, so
-you need to install this library, too. E.g.::
-
- pip install django-picklefield
-
-Alternatively follow the backend specific installation instructions above.
-
-The database backend has the ability to automatically cache the config
-values and clear them when saving. Assuming you have a ``CACHES`` setting set
-you need to set the the ``CONSTANCE_DATABASE_CACHE_BACKEND`` setting to enable
-this feature::
-
- CACHES = {
- 'default': {
- 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
- 'LOCATION': '127.0.0.1:11211',
- }
- }
- CONSTANCE_DATABASE_CACHE_BACKEND = 'default'
-
-.. note:: This won't work with a cache backend that doesn't support
- cross-process caching, because correct cache invalidation
- can't be guaranteed.
-
-.. note:: By default Constance will autofill the cache on startup and after
- saving any of the config values. If you want to disable the cache simply
- set the ``CONSTANCE_DATABASE_CACHE_AUTOFILL_TIMEOUT`` setting to ``None``.
-
-Just like the Redis backend you can set an optional prefix that is used during
-database interactions. To keep backward compatibility it defaults to ``''``
-(an empty string). To use something else do this::
-
- CONSTANCE_DATABASE_PREFIX = 'constance:myproject:'
-
-.. _django-picklefield: http://pypi.python.org/pypi/django-picklefield/
-
-Usage
------
-
-Constance can be used from your Python code and from your Django templates.
-
-* Python
-
- Accessing the config variables is as easy as importing the config
- object and accessing the variables with attribute lookups::
-
- from constance import config
-
- # ...
-
- if config.MY_SETTINGS_KEY == 42:
- answer_the_question()
-
-* Django templates
-
- To access the config object from your template, you can either
- pass the object to the template context::
-
- from django.shortcuts import render
- from constance import config
-
- def myview(request):
- return render(request, 'my_template.html', {'config': config})
-
- Or you can use the included config context processor.::
-
- TEMPLATE_CONTEXT_PROCESSORS = (
- # ...
- 'constance.context_processors.config',
- )
-
- This will add the config instance to the context of any template
- rendered with a ``RequestContext``.
-
- Then, in your template you can refer to the config values just as
- any other variable, e.g.::
-
-
Welcome on {{ config.SITE_NAME }}
- {% if config.BETA_LAUNCHED %}
- Woohoo! Head over here to use the beta.
- {% else %}
- Sadly we haven't launched yet, click here
- to signup for our newletter.
- {% endif %}
-
-Editing
-~~~~~~~
-
-Fire up your ``admin`` and you should see a new app called ``Constance``
-with ``MY_SETTINGS_KEY`` in the ``Config`` pseudo model.
-
-By default changing the settings via the admin is only allowed for super users.
-But in case you want to use the admin's ability to implement custom
-authorization checks, feel free to set the ``CONSTANCE_SUPERUSER_ONLY`` setting
-to ``False`` and give the users or user groups access to the
-``constance.change_config`` permission.
-
-Screenshots
------------
-
-.. figure:: https://github.com/comoga/django-constance/raw/master/docs/screenshot2.png
-
- The standard edit screen.
-
-.. figure:: https://github.com/comoga/django-constance/raw/master/docs/screenshot1.png
-
- The virtual application ``Constance`` among your regular applications.
-
-
-Changelog
----------
-
-v1.0 (unreleased)
-~~~~~~~~~~~~~~~~~
-
-* Added new autofill feature for the database backend cache which is enabled
- by default.
-
-* Added Django >= 1.7 migrations and moved South migrations to own folder.
- Please upgrade to South >= 1.0 to use the new South migration location.
-
-v0.6 (2013/04/12)
-~~~~~~~~~~~~~~~~~
-
-* Added Python 3 support. Supported versions: 2.6, 2.7, 3.2 and 3.3.
- For Python 3.x the use of Django > 1.5.x is required.
-
-* Fixed a serious issue with ordering in the admin when using the database
- backend. Thanks, Bouke Haarsma.
-
-* Switch to django-discover-runner as test runner to be able to run on
- Python 3.
-
-* Fixed an issue with refering to static files in the admin interface
- when using Django < 1.4.
-
-v0.5 (2013/03/02)
-~~~~~~~~~~~~~~~~~
-
-* Fixed compatibility with Django 1.5's swappable model backends.
-
-* Converted the ``key`` field of the database backend to use a ``CharField``
- with uniqueness instead of just ``TextField``.
-
- For South users we provide a migration for that change. First you
- have to "fake" the initial migration we've also added to this release::
-
- django-admin.py migrate database --fake 0001
-
- After that you can run the rest of the migrations::
-
- django-admin.py migrate database
-
-* Fixed compatibility with Django>1.4's way of refering to static files in
- the admin.
-
-* Added ability to add custom authorization checks via the new
- ``CONSTANCE_SUPERUSER_ONLY`` setting.
-
-* Added Polish translation. Thanks, Janusz Harkot.
-
-* Allow ``CONSTANCE_REDIS_CONNECTION`` being an URL instead of a dict.
-
-* Added ``CONSTANCE_DATABASE_PREFIX`` setting allow setting a key prefix.
-
-* Switched test runner to use django-nose.
+ https://github.com/jezdez/django-constance/issues
diff --git a/docs/Makefile b/docs/Makefile
new file mode 100644
index 0000000..9f906d9
--- /dev/null
+++ b/docs/Makefile
@@ -0,0 +1,177 @@
+# Makefile for Sphinx documentation
+#
+
+# You can set these variables from the command line.
+SPHINXOPTS =
+SPHINXBUILD = sphinx-build
+PAPER =
+BUILDDIR = _build
+
+# User-friendly check for sphinx-build
+ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
+$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
+endif
+
+# Internal variables.
+PAPEROPT_a4 = -D latex_paper_size=a4
+PAPEROPT_letter = -D latex_paper_size=letter
+ALLSPHINXOPTS = -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+# the i18n builder cannot share the environment and doctrees with the others
+I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) .
+
+.PHONY: help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest gettext
+
+help:
+ @echo "Please use \`make ' where is one of"
+ @echo " html to make standalone HTML files"
+ @echo " dirhtml to make HTML files named index.html in directories"
+ @echo " singlehtml to make a single large HTML file"
+ @echo " pickle to make pickle files"
+ @echo " json to make JSON files"
+ @echo " htmlhelp to make HTML files and a HTML help project"
+ @echo " qthelp to make HTML files and a qthelp project"
+ @echo " devhelp to make HTML files and a Devhelp project"
+ @echo " epub to make an epub"
+ @echo " latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter"
+ @echo " latexpdf to make LaTeX files and run them through pdflatex"
+ @echo " latexpdfja to make LaTeX files and run them through platex/dvipdfmx"
+ @echo " text to make text files"
+ @echo " man to make manual pages"
+ @echo " texinfo to make Texinfo files"
+ @echo " info to make Texinfo files and run them through makeinfo"
+ @echo " gettext to make PO message catalogs"
+ @echo " changes to make an overview of all changed/added/deprecated items"
+ @echo " xml to make Docutils-native XML files"
+ @echo " pseudoxml to make pseudoxml-XML files for display purposes"
+ @echo " linkcheck to check all external links for integrity"
+ @echo " doctest to run all doctests embedded in the documentation (if enabled)"
+
+clean:
+ rm -rf $(BUILDDIR)/*
+
+html:
+ $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
+
+dirhtml:
+ $(SPHINXBUILD) -b dirhtml $(ALLSPHINXOPTS) $(BUILDDIR)/dirhtml
+ @echo
+ @echo "Build finished. The HTML pages are in $(BUILDDIR)/dirhtml."
+
+singlehtml:
+ $(SPHINXBUILD) -b singlehtml $(ALLSPHINXOPTS) $(BUILDDIR)/singlehtml
+ @echo
+ @echo "Build finished. The HTML page is in $(BUILDDIR)/singlehtml."
+
+pickle:
+ $(SPHINXBUILD) -b pickle $(ALLSPHINXOPTS) $(BUILDDIR)/pickle
+ @echo
+ @echo "Build finished; now you can process the pickle files."
+
+json:
+ $(SPHINXBUILD) -b json $(ALLSPHINXOPTS) $(BUILDDIR)/json
+ @echo
+ @echo "Build finished; now you can process the JSON files."
+
+htmlhelp:
+ $(SPHINXBUILD) -b htmlhelp $(ALLSPHINXOPTS) $(BUILDDIR)/htmlhelp
+ @echo
+ @echo "Build finished; now you can run HTML Help Workshop with the" \
+ ".hhp project file in $(BUILDDIR)/htmlhelp."
+
+qthelp:
+ $(SPHINXBUILD) -b qthelp $(ALLSPHINXOPTS) $(BUILDDIR)/qthelp
+ @echo
+ @echo "Build finished; now you can run "qcollectiongenerator" with the" \
+ ".qhcp project file in $(BUILDDIR)/qthelp, like this:"
+ @echo "# qcollectiongenerator $(BUILDDIR)/qthelp/django-constance.qhcp"
+ @echo "To view the help file:"
+ @echo "# assistant -collectionFile $(BUILDDIR)/qthelp/django-constance.qhc"
+
+devhelp:
+ $(SPHINXBUILD) -b devhelp $(ALLSPHINXOPTS) $(BUILDDIR)/devhelp
+ @echo
+ @echo "Build finished."
+ @echo "To view the help file:"
+ @echo "# mkdir -p $$HOME/.local/share/devhelp/django-constance"
+ @echo "# ln -s $(BUILDDIR)/devhelp $$HOME/.local/share/devhelp/django-constance"
+ @echo "# devhelp"
+
+epub:
+ $(SPHINXBUILD) -b epub $(ALLSPHINXOPTS) $(BUILDDIR)/epub
+ @echo
+ @echo "Build finished. The epub file is in $(BUILDDIR)/epub."
+
+latex:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo
+ @echo "Build finished; the LaTeX files are in $(BUILDDIR)/latex."
+ @echo "Run \`make' in that directory to run these through (pdf)latex" \
+ "(use \`make latexpdf' here to do that automatically)."
+
+latexpdf:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through pdflatex..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+latexpdfja:
+ $(SPHINXBUILD) -b latex $(ALLSPHINXOPTS) $(BUILDDIR)/latex
+ @echo "Running LaTeX files through platex and dvipdfmx..."
+ $(MAKE) -C $(BUILDDIR)/latex all-pdf-ja
+ @echo "pdflatex finished; the PDF files are in $(BUILDDIR)/latex."
+
+text:
+ $(SPHINXBUILD) -b text $(ALLSPHINXOPTS) $(BUILDDIR)/text
+ @echo
+ @echo "Build finished. The text files are in $(BUILDDIR)/text."
+
+man:
+ $(SPHINXBUILD) -b man $(ALLSPHINXOPTS) $(BUILDDIR)/man
+ @echo
+ @echo "Build finished. The manual pages are in $(BUILDDIR)/man."
+
+texinfo:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo
+ @echo "Build finished. The Texinfo files are in $(BUILDDIR)/texinfo."
+ @echo "Run \`make' in that directory to run these through makeinfo" \
+ "(use \`make info' here to do that automatically)."
+
+info:
+ $(SPHINXBUILD) -b texinfo $(ALLSPHINXOPTS) $(BUILDDIR)/texinfo
+ @echo "Running Texinfo files through makeinfo..."
+ make -C $(BUILDDIR)/texinfo info
+ @echo "makeinfo finished; the Info files are in $(BUILDDIR)/texinfo."
+
+gettext:
+ $(SPHINXBUILD) -b gettext $(I18NSPHINXOPTS) $(BUILDDIR)/locale
+ @echo
+ @echo "Build finished. The message catalogs are in $(BUILDDIR)/locale."
+
+changes:
+ $(SPHINXBUILD) -b changes $(ALLSPHINXOPTS) $(BUILDDIR)/changes
+ @echo
+ @echo "The overview file is in $(BUILDDIR)/changes."
+
+linkcheck:
+ $(SPHINXBUILD) -b linkcheck $(ALLSPHINXOPTS) $(BUILDDIR)/linkcheck
+ @echo
+ @echo "Link check complete; look for any errors in the above output " \
+ "or in $(BUILDDIR)/linkcheck/output.txt."
+
+doctest:
+ $(SPHINXBUILD) -b doctest $(ALLSPHINXOPTS) $(BUILDDIR)/doctest
+ @echo "Testing of doctests in the sources finished, look at the " \
+ "results in $(BUILDDIR)/doctest/output.txt."
+
+xml:
+ $(SPHINXBUILD) -b xml $(ALLSPHINXOPTS) $(BUILDDIR)/xml
+ @echo
+ @echo "Build finished. The XML files are in $(BUILDDIR)/xml."
+
+pseudoxml:
+ $(SPHINXBUILD) -b pseudoxml $(ALLSPHINXOPTS) $(BUILDDIR)/pseudoxml
+ @echo
+ @echo "Build finished. The pseudo-XML files are in $(BUILDDIR)/pseudoxml."
diff --git a/docs/backends.rst b/docs/backends.rst
new file mode 100644
index 0000000..deeac4c
--- /dev/null
+++ b/docs/backends.rst
@@ -0,0 +1,123 @@
+.. _backends:
+
+.. highlight:: python
+
+Backends
+========
+
+Constance ships with a bunch of backends that are used to store the
+configuration values. By default it uses the Redis backend. To override
+the default please set the :setting:`CONSTANCE_BACKEND` setting to the appropriate
+dotted path.
+
+Redis
+-----
+
+The configuration values are stored in a redis store and retrieved using the
+`redis-py`_ library. Please install it like this::
+
+ pip install django-constance[redis]
+
+Configuration is simple and defaults to the following value, you don't have
+to add it to your project settings::
+
+ CONSTANCE_BACKEND = 'constance.backends.redisd.RedisBackend'
+
+.. _`redis-py`: https://pypi.python.org/pypi/redis
+
+Settings
+^^^^^^^^
+
+There are a couple of options:
+
+``CONSTANCE_REDIS_CONNECTION``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+A dictionary of parameters to pass to the to Redis client, e.g.::
+
+ CONSTANCE_REDIS_CONNECTION = {
+ 'host': 'localhost',
+ 'port': 6379,
+ 'db': 0,
+ }
+
+Alternatively you can use a URL to do the same::
+
+ CONSTANCE_REDIS_CONNECTION = 'redis://username:password@localhost:6379/0'
+
+``CONSTANCE_REDIS_CONNECTION_CLASS``
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+An (optional) dotted import path to a connection to use, e.g.::
+
+ CONSTANCE_REDIS_CONNECTION_CLASS = 'myproject.myapp.mockup.Connection'
+
+If you are using `django-redis `_,
+feel free to use the ``CONSTANCE_REDIS_CONNECTION_CLASS`` setting to define
+a callable that returns a redis connection, e.g.::
+
+ CONSTANCE_REDIS_CONNECTION_CLASS = 'redis_cache.get_redis_connection'
+
+``CONSTANCE_REDIS_PREFIX``
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+The (optional) prefix to be used for the key when storing in the Redis
+database. Defaults to ``'constance:'``. E.g.::
+
+ CONSTANCE_REDIS_PREFIX = 'constance:myproject:'
+
+Database
+--------
+
+The database backend is optional and stores the configuration values in a
+standard Django model. It requires the package `django-picklefield`_ for
+storing those values. Please install it like so::
+
+ pip install django-constance[database]
+
+You must set the ``CONSTANCE_BACKEND`` Django setting to::
+
+ CONSTANCE_BACKEND = 'constance.backends.database.DatabaseBackend'
+
+Then add the database backend app to your :setting:`INSTALLED_APPS` setting to
+make sure the data model is correctly created::
+
+ INSTALLED_APPS = (
+ # other apps
+ 'constance.backends.database',
+ )
+
+Just like the Redis backend you can set an optional prefix that is used during
+database interactions (it defaults to an empty string, ``''``). To use
+something else do this::
+
+ CONSTANCE_DATABASE_PREFIX = 'constance:myproject:'
+
+Caching
+^^^^^^^
+
+The database backend has the ability to automatically cache the config
+values and clear them when saving. Assuming you have a :setting:`CACHES`
+setting set you only need to set the the
+:setting:`CONSTANCE_DATABASE_CACHE_BACKEND` setting to the name of the
+configured cache backend to enable this feature, e.g. "default"::
+
+ CACHES = {
+ 'default': {
+ 'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
+ 'LOCATION': '127.0.0.1:11211',
+ }
+ }
+ CONSTANCE_DATABASE_CACHE_BACKEND = 'default'
+
+.. warning:: The cache feature won't work with a cache backend that is
+ incompatible with cross-process caching like the local memory
+ cache backend included in Django because correct cache
+ invalidation can't be guaranteed.
+
+.. note:: By default Constance will autofill the cache on startup and after
+ saving any of the config values. If you want to disable the cache
+ simply set the :setting:`CONSTANCE_DATABASE_CACHE_AUTOFILL_TIMEOUT`
+ setting to ``None``.
+
+.. _django-picklefield: http://pypi.python.org/pypi/django-picklefield/
diff --git a/docs/changes.rst b/docs/changes.rst
new file mode 100644
index 0000000..8a635b3
--- /dev/null
+++ b/docs/changes.rst
@@ -0,0 +1,69 @@
+Changelog
+---------
+
+v1.0 (unreleased)
+~~~~~~~~~~~~~~~~~
+
+* Added docs: http://django-constance.readthedocs.org/
+
+* Added new autofill feature for the database backend cache which is enabled
+ by default.
+
+* Added Django >= 1.7 migrations and moved South migrations to own folder.
+ Please upgrade to South >= 1.0 to use the new South migration location.
+
+* Deprecated a few old settings:
+
+ ============================== ===================================
+ deprecated replacement
+ ============================== ===================================
+ ``CONSTANCE_CONNECTION_CLASS`` ``CONSTANCE_REDIS_CONNECTION_CLASS``
+ ``CONSTANCE_CONNECTION`` ``CONSTANCE_REDIS_CONNECTION``
+ ``CONSTANCE_PREFIX`` ``CONSTANCE_REDIS_PREFIX``
+ ============================== ===================================
+
+v0.6 (2013/04/12)
+~~~~~~~~~~~~~~~~~
+
+* Added Python 3 support. Supported versions: 2.6, 2.7, 3.2 and 3.3.
+ For Python 3.x the use of Django > 1.5.x is required.
+
+* Fixed a serious issue with ordering in the admin when using the database
+ backend. Thanks, Bouke Haarsma.
+
+* Switch to django-discover-runner as test runner to be able to run on
+ Python 3.
+
+* Fixed an issue with refering to static files in the admin interface
+ when using Django < 1.4.
+
+v0.5 (2013/03/02)
+~~~~~~~~~~~~~~~~~
+
+* Fixed compatibility with Django 1.5's swappable model backends.
+
+* Converted the ``key`` field of the database backend to use a ``CharField``
+ with uniqueness instead of just ``TextField``.
+
+ For South users we provide a migration for that change. First you
+ have to "fake" the initial migration we've also added to this release::
+
+ django-admin.py migrate database --fake 0001
+
+ After that you can run the rest of the migrations::
+
+ django-admin.py migrate database
+
+* Fixed compatibility with Django>1.4's way of refering to static files in
+ the admin.
+
+* Added ability to add custom authorization checks via the new
+ ``CONSTANCE_SUPERUSER_ONLY`` setting.
+
+* Added Polish translation. Thanks, Janusz Harkot.
+
+* Allow ``CONSTANCE_REDIS_CONNECTION`` being an URL instead of a dict.
+
+* Added ``CONSTANCE_DATABASE_PREFIX`` setting allow setting a key prefix.
+
+* Switched test runner to use django-nose.
diff --git a/docs/conf.py b/docs/conf.py
new file mode 100644
index 0000000..2134a66
--- /dev/null
+++ b/docs/conf.py
@@ -0,0 +1,268 @@
+# -*- coding: utf-8 -*-
+#
+# django-constance documentation build configuration file, created by
+# sphinx-quickstart on Tue Nov 25 19:38:51 2014.
+#
+# This file is execfile()d with the current directory set to its
+# containing dir.
+#
+# Note that not all possible configuration values are present in this
+# autogenerated file.
+#
+# All configuration values have a default; values that are commented out
+# serve to show the default.
+import sys
+import os
+
+os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'tests.settings')
+
+# If extensions (or modules to document with autodoc) are in another directory,
+# add these directories to sys.path here. If the directory is relative to the
+# documentation root, use os.path.abspath to make it absolute, like shown here.
+sys.path.insert(0, os.path.abspath('extensions'))
+sys.path.insert(0, os.path.abspath('..'))
+
+# -- General configuration ------------------------------------------------
+
+# If your documentation needs a minimal Sphinx version, state it here.
+#needs_sphinx = '1.0'
+
+# Add any Sphinx extension module names here, as strings. They can be
+# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
+# ones.
+extensions = ['sphinx.ext.intersphinx', 'settings']
+
+# Add any paths that contain templates here, relative to this directory.
+templates_path = ['_templates']
+
+# The suffix of source filenames.
+source_suffix = '.rst'
+
+# The encoding of source files.
+#source_encoding = 'utf-8-sig'
+
+# The master toctree document.
+master_doc = 'index'
+
+# General information about the project.
+project = u'django-constance'
+copyright = u'2014, Comoga and individual contributors'
+
+# The short X.Y version.
+try:
+ from constance import __version__
+ # The short X.Y version.
+ version = '.'.join(__version__.split('.')[:2])
+ # The full version, including alpha/beta/rc tags.
+ release = __version__
+except ImportError:
+ version = release = 'dev'
+
+# The language for content autogenerated by Sphinx. Refer to documentation
+# for a list of supported languages.
+#language = None
+
+# There are two options for replacing |today|: either, you set today to some
+# non-false value, then it is used:
+#today = ''
+# Else, today_fmt is used as the format for a strftime call.
+#today_fmt = '%B %d, %Y'
+
+# List of patterns, relative to source directory, that match files and
+# directories to ignore when looking for source files.
+exclude_patterns = ['_build']
+
+# The reST default role (used for this markup: `text`) to use for all
+# documents.
+#default_role = None
+
+# If true, '()' will be appended to :func: etc. cross-reference text.
+#add_function_parentheses = True
+
+# If true, the current module name will be prepended to all description
+# unit titles (such as .. function::).
+#add_module_names = True
+
+# If true, sectionauthor and moduleauthor directives will be shown in the
+# output. They are ignored by default.
+#show_authors = False
+
+# The name of the Pygments (syntax highlighting) style to use.
+pygments_style = 'sphinx'
+
+# A list of ignored prefixes for module index sorting.
+#modindex_common_prefix = []
+
+# If true, keep warnings as "system message" paragraphs in the built documents.
+#keep_warnings = False
+
+
+# -- Options for HTML output ----------------------------------------------
+
+# The theme to use for HTML and HTML Help pages. See the documentation for
+# a list of builtin themes.
+html_theme = 'default'
+
+# Theme options are theme-specific and customize the look and feel of a theme
+# further. For a list of options available for each theme, see the
+# documentation.
+#html_theme_options = {}
+
+# Add any paths that contain custom themes here, relative to this directory.
+#html_theme_path = []
+
+# The name for this set of Sphinx documents. If None, it defaults to
+# " v documentation".
+#html_title = None
+
+# A shorter title for the navigation bar. Default is the same as html_title.
+#html_short_title = None
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+#html_logo = None
+
+# The name of an image file (within the static path) to use as favicon of the
+# docs. This file should be a Windows icon file (.ico) being 16x16 or 32x32
+# pixels large.
+#html_favicon = None
+
+# Add any paths that contain custom static files (such as style sheets) here,
+# relative to this directory. They are copied after the builtin static files,
+# so a file named "default.css" will overwrite the builtin "default.css".
+html_static_path = ['_static']
+
+# Add any extra paths that contain custom files (such as robots.txt or
+# .htaccess) here, relative to this directory. These files are copied
+# directly to the root of the documentation.
+#html_extra_path = []
+
+# If not '', a 'Last updated on:' timestamp is inserted at every page bottom,
+# using the given strftime format.
+#html_last_updated_fmt = '%b %d, %Y'
+
+# If true, SmartyPants will be used to convert quotes and dashes to
+# typographically correct entities.
+#html_use_smartypants = True
+
+# Custom sidebar templates, maps document names to template names.
+#html_sidebars = {}
+
+# Additional templates that should be rendered to pages, maps page names to
+# template names.
+#html_additional_pages = {}
+
+# If false, no module index is generated.
+#html_domain_indices = True
+
+# If false, no index is generated.
+#html_use_index = True
+
+# If true, the index is split into individual pages for each letter.
+#html_split_index = False
+
+# If true, links to the reST sources are added to the pages.
+#html_show_sourcelink = True
+
+# If true, "Created using Sphinx" is shown in the HTML footer. Default is True.
+#html_show_sphinx = True
+
+# If true, "(C) Copyright ..." is shown in the HTML footer. Default is True.
+#html_show_copyright = True
+
+# If true, an OpenSearch description file will be output, and all pages will
+# contain a tag referring to it. The value of this option must be the
+# base URL from which the finished HTML is served.
+#html_use_opensearch = ''
+
+# This is the file name suffix for HTML files (e.g. ".xhtml").
+#html_file_suffix = None
+
+# Output file base name for HTML help builder.
+htmlhelp_basename = 'django-constancedoc'
+
+
+# -- Options for LaTeX output ---------------------------------------------
+
+latex_elements = {
+# The paper size ('letterpaper' or 'a4paper').
+#'papersize': 'letterpaper',
+
+# The font size ('10pt', '11pt' or '12pt').
+#'pointsize': '10pt',
+
+# Additional stuff for the LaTeX preamble.
+#'preamble': '',
+}
+
+# Grouping the document tree into LaTeX files. List of tuples
+# (source start file, target name, title,
+# author, documentclass [howto, manual, or own class]).
+latex_documents = [
+ ('index', 'django-constance.tex', u'django-constance Documentation',
+ u'Comoga and individual contributors', 'manual'),
+]
+
+# The name of an image file (relative to this directory) to place at the top of
+# the title page.
+#latex_logo = None
+
+# For "manual" documents, if this is true, then toplevel headings are parts,
+# not chapters.
+#latex_use_parts = False
+
+# If true, show page references after internal links.
+#latex_show_pagerefs = False
+
+# If true, show URL addresses after external links.
+#latex_show_urls = False
+
+# Documents to append as an appendix to all manuals.
+#latex_appendices = []
+
+# If false, no module index is generated.
+#latex_domain_indices = True
+
+
+# -- Options for manual page output ---------------------------------------
+
+# One entry per manual page. List of tuples
+# (source start file, name, description, authors, manual section).
+man_pages = [
+ ('index', 'django-constance', u'django-constance Documentation',
+ [u'Comoga and individual contributors'], 1)
+]
+
+# If true, show URL addresses after external links.
+#man_show_urls = False
+
+
+# -- Options for Texinfo output -------------------------------------------
+
+# Grouping the document tree into Texinfo files. List of tuples
+# (source start file, target name, title, author,
+# dir menu entry, description, category)
+texinfo_documents = [
+ ('index', 'django-constance', u'django-constance Documentation',
+ u'Comoga and individual contributors', 'django-constance', 'One line description of project.',
+ 'Miscellaneous'),
+]
+
+# Documents to append as an appendix to all manuals.
+#texinfo_appendices = []
+
+# If false, no module index is generated.
+#texinfo_domain_indices = True
+
+# How to display URL addresses: 'footnote', 'no', or 'inline'.
+#texinfo_show_urls = 'footnote'
+
+# If true, do not generate a @detailmenu in the "Top" node's menu.
+#texinfo_no_detailmenu = False
+
+# Example configuration for intersphinx: refer to the Python standard library.
+intersphinx_mapping = {
+ 'http://docs.python.org/': None,
+ 'django': ('http://docs.djangoproject.com/en/dev/',
+ 'http://docs.djangoproject.com/en/dev/_objects/'),
+}
diff --git a/docs/extensions/__init__.py b/docs/extensions/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/docs/extensions/settings.py b/docs/extensions/settings.py
new file mode 100644
index 0000000..2551233
--- /dev/null
+++ b/docs/extensions/settings.py
@@ -0,0 +1,6 @@
+def setup(app):
+ app.add_crossref_type(
+ directivename="setting",
+ rolename="setting",
+ indextemplate="pair: %s; setting",
+ )
diff --git a/docs/index.rst b/docs/index.rst
new file mode 100644
index 0000000..be8b832
--- /dev/null
+++ b/docs/index.rst
@@ -0,0 +1,147 @@
+Constance - Dynamic Django settings
+===================================
+
+Features
+--------
+
+* Easily migrate your static settings to dynamic settings.
+* Admin interface to edit the dynamic settings.
+
+Installation
+------------
+
+Install from PyPI the backend specific variant of django-constance:
+
+For the (default) Redis backend::
+
+ pip install django-constance[redis]
+
+For the database backend::
+
+ pip install django-constance[database]
+
+Alternatively -- if you're sure that the dependencies are already
+installed -- you can also run::
+
+ pip install django-constance
+
+Configuration
+-------------
+
+Modify your ``settings.py``. Add ``'constance'`` to your
+:setting:`INSTALLED_APPS`, and move each key you want to turn dynamic into
+the :setting:`CONSTANCE_CONFIG` section, like this:
+
+.. code-block:: python
+
+ INSTALLED_APPS = (
+ ...
+ 'constance',
+ )
+
+ CONSTANCE_CONFIG = {
+ 'THE_ANSWER': (42, 'Answer to the Ultimate Question of Life, '
+ 'The Universe, and Everything'),
+ }
+
+Here, ``42`` is the default value for the key ``THE_ANSWER`` if it is
+not found in the backend. The other member of the tuple is a help text the
+admin will show.
+
+See the :ref:`Backends ` section how to setup the backend.
+
+Usage
+-----
+
+Constance can be used from your Python code and from your Django templates.
+
+Python
+^^^^^^
+
+Accessing the config variables is as easy as importing the config
+object and accessing the variables with attribute lookups::
+
+ from constance import config
+
+ # ...
+
+ if config.THE_ANSWER == 42:
+ answer_the_question()
+
+Django templates
+^^^^^^^^^^^^^^^^
+
+To access the config object from your template you can either
+pass the object to the template context:
+
+.. code-block:: python
+
+ from django.shortcuts import render
+ from constance import config
+
+ def myview(request):
+ return render(request, 'my_template.html', {'config': config})
+
+Or you can use the included config context processor.:
+
+.. code-block:: python
+
+ TEMPLATE_CONTEXT_PROCESSORS = (
+ # ...
+ 'constance.context_processors.config',
+ )
+
+This will add the config instance to the context of any template
+rendered with a ``RequestContext``.
+
+Then, in your template you can refer to the config values just as
+any other variable, e.g.:
+
+.. code-block:: django
+
+
Welcome on {{ config.SITE_NAME }}
+ {% if config.BETA_LAUNCHED %}
+ Woohoo! Head over here to use the beta.
+ {% else %}
+ Sadly we haven't launched yet, click here
+ to signup for our newletter.
+ {% endif %}
+
+Editing
+-------
+
+Fire up your ``admin`` and you should see a new app called ``Constance``
+with ``THE_ANSWER`` in the ``Config`` pseudo model.
+
+By default changing the settings via the admin is only allowed for super users.
+But in case you want to use the admin's ability to implement custom
+authorization checks, feel free to set the :setting:`CONSTANCE_SUPERUSER_ONLY`
+setting to ``False`` and give the users or user groups access to the
+``constance.change_config`` permission.
+
+Screenshots
+-----------
+
+.. figure:: screenshot2.png
+
+ The standard edit screen.
+
+.. figure:: screenshot1.png
+
+ The virtual application ``Constance`` among your regular applications.
+
+More documentation
+------------------
+
+.. toctree::
+ :maxdepth: 2
+
+ backends
+ changes
+
+Indices and tables
+==================
+
+* :ref:`genindex`
+* :ref:`modindex`
+* :ref:`search`
diff --git a/docs/make.bat b/docs/make.bat
new file mode 100644
index 0000000..5b5f2a6
--- /dev/null
+++ b/docs/make.bat
@@ -0,0 +1,242 @@
+@ECHO OFF
+
+REM Command file for Sphinx documentation
+
+if "%SPHINXBUILD%" == "" (
+ set SPHINXBUILD=sphinx-build
+)
+set BUILDDIR=_build
+set ALLSPHINXOPTS=-d %BUILDDIR%/doctrees %SPHINXOPTS% .
+set I18NSPHINXOPTS=%SPHINXOPTS% .
+if NOT "%PAPER%" == "" (
+ set ALLSPHINXOPTS=-D latex_paper_size=%PAPER% %ALLSPHINXOPTS%
+ set I18NSPHINXOPTS=-D latex_paper_size=%PAPER% %I18NSPHINXOPTS%
+)
+
+if "%1" == "" goto help
+
+if "%1" == "help" (
+ :help
+ echo.Please use `make ^` where ^ is one of
+ echo. html to make standalone HTML files
+ echo. dirhtml to make HTML files named index.html in directories
+ echo. singlehtml to make a single large HTML file
+ echo. pickle to make pickle files
+ echo. json to make JSON files
+ echo. htmlhelp to make HTML files and a HTML help project
+ echo. qthelp to make HTML files and a qthelp project
+ echo. devhelp to make HTML files and a Devhelp project
+ echo. epub to make an epub
+ echo. latex to make LaTeX files, you can set PAPER=a4 or PAPER=letter
+ echo. text to make text files
+ echo. man to make manual pages
+ echo. texinfo to make Texinfo files
+ echo. gettext to make PO message catalogs
+ echo. changes to make an overview over all changed/added/deprecated items
+ echo. xml to make Docutils-native XML files
+ echo. pseudoxml to make pseudoxml-XML files for display purposes
+ echo. linkcheck to check all external links for integrity
+ echo. doctest to run all doctests embedded in the documentation if enabled
+ goto end
+)
+
+if "%1" == "clean" (
+ for /d %%i in (%BUILDDIR%\*) do rmdir /q /s %%i
+ del /q /s %BUILDDIR%\*
+ goto end
+)
+
+
+%SPHINXBUILD% 2> nul
+if errorlevel 9009 (
+ echo.
+ echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
+ echo.installed, then set the SPHINXBUILD environment variable to point
+ echo.to the full path of the 'sphinx-build' executable. Alternatively you
+ echo.may add the Sphinx directory to PATH.
+ echo.
+ echo.If you don't have Sphinx installed, grab it from
+ echo.http://sphinx-doc.org/
+ exit /b 1
+)
+
+if "%1" == "html" (
+ %SPHINXBUILD% -b html %ALLSPHINXOPTS% %BUILDDIR%/html
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/html.
+ goto end
+)
+
+if "%1" == "dirhtml" (
+ %SPHINXBUILD% -b dirhtml %ALLSPHINXOPTS% %BUILDDIR%/dirhtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/dirhtml.
+ goto end
+)
+
+if "%1" == "singlehtml" (
+ %SPHINXBUILD% -b singlehtml %ALLSPHINXOPTS% %BUILDDIR%/singlehtml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The HTML pages are in %BUILDDIR%/singlehtml.
+ goto end
+)
+
+if "%1" == "pickle" (
+ %SPHINXBUILD% -b pickle %ALLSPHINXOPTS% %BUILDDIR%/pickle
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the pickle files.
+ goto end
+)
+
+if "%1" == "json" (
+ %SPHINXBUILD% -b json %ALLSPHINXOPTS% %BUILDDIR%/json
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can process the JSON files.
+ goto end
+)
+
+if "%1" == "htmlhelp" (
+ %SPHINXBUILD% -b htmlhelp %ALLSPHINXOPTS% %BUILDDIR%/htmlhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run HTML Help Workshop with the ^
+.hhp project file in %BUILDDIR%/htmlhelp.
+ goto end
+)
+
+if "%1" == "qthelp" (
+ %SPHINXBUILD% -b qthelp %ALLSPHINXOPTS% %BUILDDIR%/qthelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; now you can run "qcollectiongenerator" with the ^
+.qhcp project file in %BUILDDIR%/qthelp, like this:
+ echo.^> qcollectiongenerator %BUILDDIR%\qthelp\django-constance.qhcp
+ echo.To view the help file:
+ echo.^> assistant -collectionFile %BUILDDIR%\qthelp\django-constance.ghc
+ goto end
+)
+
+if "%1" == "devhelp" (
+ %SPHINXBUILD% -b devhelp %ALLSPHINXOPTS% %BUILDDIR%/devhelp
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished.
+ goto end
+)
+
+if "%1" == "epub" (
+ %SPHINXBUILD% -b epub %ALLSPHINXOPTS% %BUILDDIR%/epub
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The epub file is in %BUILDDIR%/epub.
+ goto end
+)
+
+if "%1" == "latex" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished; the LaTeX files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdf" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "latexpdfja" (
+ %SPHINXBUILD% -b latex %ALLSPHINXOPTS% %BUILDDIR%/latex
+ cd %BUILDDIR%/latex
+ make all-pdf-ja
+ cd %BUILDDIR%/..
+ echo.
+ echo.Build finished; the PDF files are in %BUILDDIR%/latex.
+ goto end
+)
+
+if "%1" == "text" (
+ %SPHINXBUILD% -b text %ALLSPHINXOPTS% %BUILDDIR%/text
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The text files are in %BUILDDIR%/text.
+ goto end
+)
+
+if "%1" == "man" (
+ %SPHINXBUILD% -b man %ALLSPHINXOPTS% %BUILDDIR%/man
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The manual pages are in %BUILDDIR%/man.
+ goto end
+)
+
+if "%1" == "texinfo" (
+ %SPHINXBUILD% -b texinfo %ALLSPHINXOPTS% %BUILDDIR%/texinfo
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The Texinfo files are in %BUILDDIR%/texinfo.
+ goto end
+)
+
+if "%1" == "gettext" (
+ %SPHINXBUILD% -b gettext %I18NSPHINXOPTS% %BUILDDIR%/locale
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The message catalogs are in %BUILDDIR%/locale.
+ goto end
+)
+
+if "%1" == "changes" (
+ %SPHINXBUILD% -b changes %ALLSPHINXOPTS% %BUILDDIR%/changes
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.The overview file is in %BUILDDIR%/changes.
+ goto end
+)
+
+if "%1" == "linkcheck" (
+ %SPHINXBUILD% -b linkcheck %ALLSPHINXOPTS% %BUILDDIR%/linkcheck
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Link check complete; look for any errors in the above output ^
+or in %BUILDDIR%/linkcheck/output.txt.
+ goto end
+)
+
+if "%1" == "doctest" (
+ %SPHINXBUILD% -b doctest %ALLSPHINXOPTS% %BUILDDIR%/doctest
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Testing of doctests in the sources finished, look at the ^
+results in %BUILDDIR%/doctest/output.txt.
+ goto end
+)
+
+if "%1" == "xml" (
+ %SPHINXBUILD% -b xml %ALLSPHINXOPTS% %BUILDDIR%/xml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The XML files are in %BUILDDIR%/xml.
+ goto end
+)
+
+if "%1" == "pseudoxml" (
+ %SPHINXBUILD% -b pseudoxml %ALLSPHINXOPTS% %BUILDDIR%/pseudoxml
+ if errorlevel 1 exit /b 1
+ echo.
+ echo.Build finished. The pseudo-XML files are in %BUILDDIR%/pseudoxml.
+ goto end
+)
+
+:end