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

This is small helper that makes it easier to store distributable django app settings in project settings.py as a dict. Purpose is to keep settings file simple and clean. With this it’s also easier to set defaults for the settings and warn about settings that have been removed.

Helper also supports marking settings that should be imported before returning. Import is done using django.utils.module_loading.import_string.

Helper resolves variables when requested for the first time and caches the value for faster lookup next time. Variables that are not in required or defaults raise AttributeError. If you like to clear the cache, you can use _clear_cached(), though there shouldn’t be need for that as the helper automatically does it if the setting changes.

Design is based on class done in Django REST framework.

Example

Setting defitions in your applications app_settings.py (for example):

from django_settingsdict import SettingsDict
REQUIRED = (
    'IMPORTANT_SETTING',
)
DEFAULTS = {
    'URL_NAME': 'test_app',
    'REVERSE_FUNC': 'django.core.urlresolvers.reverse',
}
IMPORT_STRINGS = (
    'REVERSE_FUNC',
)
REMOVED = (
    'OLD_SETTING',
)
app_settings = SettingsDict('MY_APP',
                            required=REQUIRED,
                            defaults=DEFAULTS,
                            removed=REMOVED,
                            import_strings=IMPORT_STRINGS)

Configuration in your projects settings.py:

MY_APP = {
    'IMPORTANT_SETTING': 'some value',
    'URL_NAME': 'test_app_2',
}

And in your application code:

from .app_settings import app_settings

print(app_settings.IMPORTANT_SETTING)
print(app_settings.URL_NAME)
print(app_settings.REVERSE_FUNC)

would make following result:

some value
test_app_2
<function reverse at 0x7fd5119e0578>
Release History

Release History

1.0.0

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

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-settingsdict-1.0.0.tar.gz (4.5 kB) Copy SHA256 Checksum SHA256 Source Oct 17, 2016

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