Skip to main content

A very simple settings configurable in Django Admin Panel.

Project description

Supported types: bool, float, int, str.

https://badge.fury.io/py/django-simple-settings.png https://api.travis-ci.org/alikus/django-simple-settings.png https://coveralls.io/repos/alikus/django-simple-settings/badge.png?branch=master

Installation

  1. Install a package.
$ pip install django-simple-settings
  1. Add “simple_settings” to your INSTALLED_APPS setting:
INSTALLED_APPS = (
    ...
    'simple_settings',
)
  1. Add context processor if you would like:
TEMPLATE_CONTEXT_PROCESSORS = (
    '...',
    'simple_settings.context_processors.simple_settings',
)
  1. 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+

Project details


Release history Release notifications

This version
History Node

0.3.1

History Node

0.3

History Node

0.2

History Node

0.1

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-simple-settings-0.3.1.tar.gz (4.7 kB) Copy SHA256 hash SHA256 Source None Dec 12, 2013

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page