django-constance/README.rst
2010-08-25 11:24:40 +02:00

55 lines
1.1 KiB
ReStructuredText

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'),
}
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.