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
app_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
Built Distribution
File details
Details for the file django-zero-settings-0.1.5.tar.gz
.
File metadata
- Download URL: django-zero-settings-0.1.5.tar.gz
- Upload date:
- Size: 16.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
b1784effc475851003b6811124773ae7c7ed0ba3b8e081d20682954779fabca3
|
|
MD5 |
9c0fd82e2efed226cdf156c3ad4fcaec
|
|
BLAKE2b-256 |
a3bed375cda1e436a182c92165728117b320d9f81e512a8e10bff5a010a8d05b
|
File details
Details for the file django_zero_settings-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: django_zero_settings-0.1.5-py3-none-any.whl
- Upload date:
- Size: 16.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.6
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 |
9378e3eece7d5113beec91dba173773ddca8a7360c3859d0c9e6b6ba33ffc6de
|
|
MD5 |
420a0dc0fb9a613d10af2849e1172059
|
|
BLAKE2b-256 |
cc2df3d6075c31c2592a05e872c1e88fc76c3e4241419e223092e73da54ffa0d
|