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
File details
Details for the file dsgen-2.23012005.1342-py3-none-any.whl
.
File metadata
- Download URL: dsgen-2.23012005.1342-py3-none-any.whl
- Upload date:
- Size: 34.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.0.0 CPython/3.11.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 955035bc00b0780f725d42b99aec6c09fa42413e6688c20a0ea11f290bf0f950 |
|
MD5 | e3b2ed673536d6156bb38a4d35eccfe0 |
|
BLAKE2b-256 | 85f904a6ab18d2f60ef8a4c4a2a92680d2b8b228564847b1226857a9633dffae |