Metadata-Version: 1.1
Name: django-settingsdict
Version: 1.0.1
Summary: Simple helper class to handle dict style settings for django app
Home-page: https://github.com/raphendyr/django-settingsdict
Author: Jaakko Kantojärvi
Author-email: jaakko@n-1.fi
License: BSD
Download-URL: https://github.com/raphendyr/django-settingsdict/archive/1.0.1.tar.gz
Description: Django settings dict
        ====================
        
        This is small helper that makes it easier to store distributable django app settings in project :code:`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 :code:`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 :code:`required` or :code:`defaults` raise :code:`AttributeError`.
        If you like to clear the cache, you can use :code:`_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 <https://github.com/tomchristie/django-rest-framework>`_.
        
        
        Example
        -------
        
        Setting defitions in your applications :code:`app_settings.py` (for example):
        
        .. code-block:: python
        
          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 :code:`settings.py`:
        
        .. code-block:: python
        
          MY_APP = {
              'IMPORTANT_SETTING': 'some value',
              'URL_NAME': 'test_app_2',
          }
        
        And in your application code:
        
        .. code-block:: python
        
          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:
        
        .. code-block::
        
          some value
          test_app_2
          <function reverse at 0x7fd5119e0578>
        
Keywords: django settings
Platform: UNKNOWN
Classifier: Development Status :: 4 - Beta
Classifier: License :: OSI Approved :: BSD License
Classifier: Intended Audience :: Developers
Classifier: Environment :: Web Environment
Classifier: Operating System :: OS Independent
Classifier: Topic :: Software Development :: Build Tools
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Framework :: Django
Classifier: Framework :: Django :: 1.8
Classifier: Framework :: Django :: 1.9
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.4
Classifier: Programming Language :: Python :: 3.5
