ideallical Django package settings, making settings for your custom Django package easier to maintain
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
ii_django_package_settings
.flake8
.gitignore
CHANGELOG.md
LICENSE.md
MANIFEST.in
README.md
setup.cfg
setup.py

README.md

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 ii_django_package_settings.settings import PackageSettings


class BackupSettings(PackageSettings):
    NAME = 'II_DJANGO_BACKUP'
    DOC = 'https://github.com/ideallical/ii-django-backup/'
    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