Skip to main content

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


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

dsgen-2.23012005.1342-py3-none-any.whl (34.7 kB view details)

Uploaded Python 3

File details

Details for the file dsgen-2.23012005.1342-py3-none-any.whl.

File metadata

File hashes

Hashes for dsgen-2.23012005.1342-py3-none-any.whl
Algorithm Hash digest
SHA256 955035bc00b0780f725d42b99aec6c09fa42413e6688c20a0ea11f290bf0f950
MD5 e3b2ed673536d6156bb38a4d35eccfe0
BLAKE2b-256 85f904a6ab18d2f60ef8a4c4a2a92680d2b8b228564847b1226857a9633dffae

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page