Dynamic Django settings.
Find a file
2010-09-17 14:54:30 +02:00
constance changed some display settings 2010-09-03 16:18:17 +02:00
tests added tests for other types 2010-09-03 14:38:43 +02:00
.hgignore moved settings 2010-08-25 15:08:07 +02:00
AUTHORS added README 2010-08-25 10:30:58 +02:00
LICENSE added a license 2010-09-03 16:54:11 +02:00
MANIFEST.in fixed packaging: templates included 2010-08-24 11:48:23 +02:00
README.rst added screenshots to the description 2010-09-03 16:39:16 +02:00
setup.py updated setup.py 2010-09-17 14:54:30 +02:00

Dynamic Django settings in Redis.

Features
========

* Easy migrate your static settings to dynamic settings.
* Admin interface to edit the dynamic settings.

Installation
============

Install from here using ``pip``::

    pip install -e hg+http://bitbucket.org/comoga/django-constance#egg=django-constance

Configuration
=============

Modify your ``settings.py``. Add ``constance`` to your ``INSTALLED_APPS``,
point ``CONSTANCE_CONNECTION`` to your Redis instance, and move each
key you want to turn dynamic into the ``CONSTANCE_CONFIG`` section, like this::


    INSTALLED_APPS = (
        ...
        'constance',
    )

    CONSTANCE_CONNECTION = {
        'host': 'localhost',
        'port': 6379,
        'db': 0,
    }


    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 Redis. The other member of the tuple is a help text the admin
will show.

Usage
=====

::

    from constance import config

    ...

    if config.MY_SETTINGS_KEY == 42:
        answer_the_question()


Fire up your ``admin`` and you should see a new application ``Constance``
with ``MY_SETTINGS_KEY`` in the ``Config`` pseudo model.

Screenshots
===========

.. figure:: http://bitbucket.org/comoga/django-constance/wiki/screenshot2.png

   The standard edit screen.

.. figure:: http://bitbucket.org/comoga/django-constance/wiki/screenshot1.png

   The virtual application ``Constance`` among your regular applications.