Skip to main content

A unified settings system for pluggable django apps

Project description

Django appsettings

finally, a unified system for pluggable apps to have configurable settings. the django-appsettings app provides a clean api for keeping track of settings, and, most importantly, having settings that are configurable for a user that does not have write access to your server :) appsettings also provides an interface (similar to the admin interface for models) for editing these settings.

Todo

  • unittests

  • the web interface; hopefully with customizeable templates

Usage

So you want to use this in your app? Well, just create a settings.py for your app (which will be autodiscovered by _appsettings_) and register your settings. Example:

import appsettings
from appsettings import values
register = appsettings.register('mymodule')

# settings are organized into groups.
# this will define settings
# mymodule.story.greeting,
# mymodule.story.pigs,
# etc.
@register
class Story:
    # int, string, and float types are auto-discovered.
    greeting = "hello"
    pigs = 3
    wolves = 1
    # or you can specify the type
    houses = valuse.IntValue(3, doc = "number of houses in which to hide")
    myhouse = values.ChoiceValue(['straw','sticks','bricks'], 'straw')

using the settings in the rest of your app couldn’t be easier:

from appsettings import settings.mymodule as settings

def run_away():
    return "%s pigs are running into a house made of %s"
                    %(settings.story.pigs, settings.story.myhouse)

more thorough documentation (hopefully sphinx-pretty API docs) to come shortly.

Project details


Download files

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

Source Distribution

django-appsettings-0.1.tar.gz (4.3 kB view details)

Uploaded Source

File details

Details for the file django-appsettings-0.1.tar.gz.

File metadata

File hashes

Hashes for django-appsettings-0.1.tar.gz
Algorithm Hash digest
SHA256 c5427d525e6cbc64a05b1e5dea776381ae527315a8df5bdc76631a7fa0d394ac
MD5 d33308ee56c9258d2e585a6775f68084
BLAKE2b-256 6782403cafc5ecdfa33622839231afd3998c5c3b6993782968c2c82b2f33fc9c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page