A Django util for managing app settings.
Project description
Django Zero Settings
a Django util for managing app settings.
pip install django-zero-settings
Usage
you will create a settings object like:
from zero_settings import ZeroSettings
settings = ZeroSettings(
# key will be used to get user settings from Django settings
# required, must be string
key="ZERO_SETTINGS",
# defaults settings
# required, must be dict
defaults={
"TEST_KEY": "test_key"
"TEST_IMPORT": "module.file.class_name",
"TEST_IMPORT_LIST": [
"module.file.class_name_1",
"module.file.class_name_2",
]
},
# manually defining user settings,
# by default settings will be loaded from Django settings with key,
# optional, can be dict or None
user_settings=None,
# list of settings that must be imported, lazy check,
# optional, can be list/tuple or None
import_settings=["TEST_IMPORT", "TEST_IMPORT_LIST"],
# dict of settings that had be removed,
# message can be None or empty string to show default,
# optional, can be dict or None
removed_settings={
"TEST_REMOVED": "An error message to show",
"TEST_ANOTHER_REMOVED": "", # or None
},
# settings documents location, to refer user to
# optional, can be str or None
settings_doc="https://app.com/doc/settings"
)
then you can import it and use:
from app.settings import app_settings
print(app_settings.TEST_KEY)
you can register settings for auto reload on change:
from zero_settings import ZeroSettings, register_reload
# create your app settings
app_settings = ZeroSettings(...)
# register app settings
register_reload(app_settings)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
django-zero-settings-0.1.3.tar.gz
(16.3 kB
view hashes)
Built Distribution
Close
Hashes for django-zero-settings-0.1.3.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ade8b3d129ef32e4f1cc74273b9a6cfb051872534f3b6db9d6aa252c69fe41b6 |
|
MD5 | dc6734b27408a58bea0e514e276a7d23 |
|
BLAKE2b-256 | 7511bf404eee12a5c31d34934b1bc53f246f45ba7d8e5abc4363d79e2bb2c796 |
Close
Hashes for django_zero_settings-0.1.3-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 752b5f1173c48a2cb4658397a7948209a852bae0cf08485538f2aaa509d2a8a4 |
|
MD5 | 037277ae1427a070acbd7bfb184ab744 |
|
BLAKE2b-256 | f1270ff050e1123164d9db6a0e321bc473ecf04d1a2e640546ccaec3dea73afc |