ii-django-package-settings

ideallical django package settings


Keywords
django, package, settings
License
BSD-3-Clause
Install
pip install ii-django-package-settings==0.1

Documentation

ideallical Django package settings

pypi-version

Acknowledgments

This package is heavily inspired by django-restframework settings.

Requirements

  • Python (3.5)

Installation in your Django package

Install in your package's setup.py:

setup(
    [..]
    install_requires=[
        'ii_django_package_settings>=0.1'
    ],
    [..]
)

Configuration for your Django package

Create a settings.py file in the root of your package with the following content (based on ii-django-backup):

from django.conf import settings

from ii_django_package_settings.settings import PackageSettings


class BackupSettings(PackageSettings):
    NAME = 'II_DJANGO_BACKUP'
    DOC = 'https://github.com/ideallical/ii-django-package-settings/'
    DEFAULTS = {
        'NAME_GENERATOR_FUNC': 'ii_django_backup.name_generators.default',
        'DROPBOX_ACCESS_TOKEN': None,
        'DROPBOX_DIR': None,
        'USE_GZIP': True,
    }
    IMPORT_STRINGS = ('NAME_GENERATOR_FUNC', )
    REMOVED_SETTINGS = ()


backup_settings = BackupSettings(None)

Then in your package you can refer to these settings like so:

from ii_django_backup.settings import backup_settings


backup_settings.DROPBOX_ACCESS_TOKEN