Supported types: bool, float, int, str.
Installation
Install a package.
$ pip install django-simple-settings
Add “simple_settings” to your INSTALLED_APPS setting:
INSTALLED_APPS = (
...
'simple_settings',
)
Add context processor if you would like:
TEMPLATE_CONTEXT_PROCESSORS = (
'...',
'simple_settings.context_processors.simple_settings',
)
Create models:
$ python manage.py migrate || python manage.py syncdb
Usage
Get settings:
from simple_settings import settings
print settings.get('is_feature_available')
print settings.get('is_feature_available', default=False)
print settings['is_feature_available']
Get all settings as dict:
print settings.all()
Get settings in template if you include context processor:
{{ simple_settings.is_feature_available }}
Set settings:
settings.set('is_feature_available', True)
settings.set('pi', 3.14159265359)
settings.set('answer', 42)
settings.set('metallica', 'Yeah!')
Delete settings:
settings.delete('is_feature_available')
Settings
Default application settings can be overriden in settings.py:
SIMPLE_SETTINGS_CACHE_TIMEOUT = 60 * 60 * 24 # default cache timeout is one day
SIMPLE_SETTINGS_CACHE_ALIAS = 'default' # default cache backend
Requirements
Python 2.6, 2.7, 3.3
Django 1.3+
Metadata
Release files for django-simple-settings 0.3.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-simple-settings-0.3.1.tar.gz | 4.7 kB | Details |
Release files / django-simple-settings-0.3.1.tar.gz
| Download URL | django-simple-settings-0.3.1.tar.gz |
|---|---|
| Size | 4.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
81f1b360834831218b7f17d27ac0da2653fc90cfb6992a93f05af9ac99388cf0
|
|
BLAKE2b-256 checksum How to use checksums |
e1476b02db76763ad6507cd64d3660ccff795014bd97536cf8619a853522eff5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |