Skip to main content

A simple Django app to have simple typed settings.

Project description

Master Settings is a simple Django app to have simple typed settings in django app with type validation.

Installation & Setup

  1. Install using pip
$> pip install django-ma-settings
  1. add ‘ma-settings’ into INSTALLED_APPS
    # ...
    # ...
  1. define MASTER_SETTINGS dict with your settings definition


        'type' : '(setting_type)',
        'display_name': '(displayed name)', #optional
        'default': (default value), # optional
        'options': (choice options), # optional
        'model': (foreign model), # optional, use only when foreign type is chosen


    'max_email_size_kb': {
        'type': 'integer',
        'display_name': 'Max email size(kb)',
        'default': 400,
    'text_color': {
        'type': 'choices',
        'display_name': 'Text color',
        'options': ['White', 'Black', 'Red', 'Blue'],
        'default': 'White',
    'our_rate': {
        'type': 'float',
        'display_name': 'Our rate',
        'default': 1.0,
    'email_from': {
        'type': 'string'
        'display_name': 'Email from',
    'Default client': {
        'type': 'foreign',
        'model': 'my_app.Client'
BASE_SETTINGS_TEMPLATE_NAME = "template_name.html"

#  Template file must contain empty {% block settings %}
  1. in add include(‘ma_settings.urls’)
url(r'^settings/', include('ma_settings.urls')),

#  Use url name 'master_settings_home' to access settings page

{% url 'master_settings_home' %}
  1. Run commands to initialize settings
$> python syncdb
$> python init_settings


To get setting use

from ma_settings import master_settings
master_settings.get('setting_name', default='default')

To set new value:

master_settings.set('setting_name', [value|model_instance])

To check if setting exists:


Updating settings definition

After updating settings definition in run this command to update settings

python init_settings

Project details

Download files

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

Files for django-ma-settings, version 1.0.9
Filename, size File type Python version Upload date Hashes
Filename, size django-ma-settings-1.0.9.tar.gz (7.5 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring DigiCert DigiCert EV certificate Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page