Generator For Django Settings
Project description
dsgen
License
Apache License Version 2.0
Usage
a) used in a single app:
# app/settings.py
from django.test.signal import setting_changed
from dsgen.utils import DSetting
class AppSetting(DSettting):
SETTING_NAME = 'DEMO_APP_SETTING'
DEFAULT = {
'': False,
}
def get_passthrough_fields(self):
fields = (
'MEDIA_ROOT',
)
return fields
app_setting = AppSetting()
setting_changed.connect(app_setting.signal_handler_setting_changed)
b) used in project:
# project/settings.py
import os
from dsgen.utils import DSGenerator
class ProjectSetting(DSGenerator):
DEFAULT_JSON_FILE = 'project.json'
default_app_list = [
'django.contrib.auth',
'coolapp',
]
_proj = ProjectSetting(
json_path=os.getenv(
'PROJECT_CONFIG_JSON',
os.path.join(
'/etc',
'coolproject',
ProjectSetting.DEFAULT_JSON_FILE
)
)
)
__dir__ = _proj.get_config_field_list
__getattr__ = _proj.get_config_value
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 Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for dsgen-2.23011025.1432-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71335aa31a4f9af9da9efd0afcd207fde66b78ca9a323fd34ab1df485faf4c97 |
|
MD5 | bd190fdc9d8fcdf9960ccb5e934f94f8 |
|
BLAKE2b-256 | 02626fd6b1a1d16d26f937fd91a9989c74825d26a819fa919b6b0d9969c4ffd3 |