django-constanceDjango live settings stored in Redis | |
Download |
django-constance Ranking & Summary
Advertisement
- License:
- BSD License
- Publisher Name:
- Comoga Django Team
- Publisher web site:
- http://comoga.cz
django-constance Tags
django-constance Description
Django live settings stored in Redis django-constance is a Django app that provides dynamic Django settings in Redis.InstallationInstall from here using pip:pip install -e hg+http://bitbucket.org/comoga/django-constance#egg=django-constanceConfigurationModify 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.Usagefrom 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.
django-constance Related Software