This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
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
INSTALLED_APPS = (
    # ...
    'ma_settings',
    # ...
)
  1. define MASTER_SETTINGS dict with your settings definition

template:

MASTER_SETTINGS = {
    '(setting_name)':{
        '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
    }
}

example:

MASTER_SETTINGS = {
    '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'
    }
}
  1. define BASE_SETTINGS_TEMPLATE_NAME
BASE_SETTINGS_TEMPLATE_NAME = "template_name.html"

#  Template file must contain empty {% block settings %}
  1. in urls.py 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 manage.py syncdb
$> python manage.py init_settings

Using

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:

master_settings.exists('setting_name')

Updating settings definition

After updating settings definition in settings.py run this command to update settings

python manage.py init_settings
Release History

Release History

1.0.9

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.8

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.7

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.6

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.5

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.4

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.3

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

1.0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
django-ma-settings-1.0.9.tar.gz (7.5 kB) Copy SHA256 Checksum SHA256 Source Apr 18, 2015

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting