Registry / devops / django-settings-holder

django-settings-holder

JSON →
library0.3.0pypypi✓ verified 86d ago

A lightweight Django library that allows settings to be accessed as object attributes (e.g., settings.DEBUG) instead of via dict-like settings['DEBUG']. Current version 0.3.0, compatible with Python >=3.10 and <4. Simple, stable API with no breaking changes since initial release.

pip install django-settings-holder
INSTALL
IMPORT
SIG · DJANGO-SETTINGS-HO
D
django-settings-holder
devopspythonv0.3.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

SettingsHolder
from settings_holder import SettingsHolder
Correct import path as per latest documentation.

Create a SettingsHolder with defaults and access settings as attributes.

from settings_holder import SettingsHolder # Create a holder with defaults settings = SettingsHolder('MYAPP', defaults={ 'API_KEY': os.environ.get('MYAPP_API_KEY', ''), 'TIMEOUT': 30, }) # Use as attributes print(settings.API_KEY) # Access via attribute settings.TIMEOUT = 60 # Setting via attribute
Debug
Known issues
gotchaThe SettingsHolder only supports attribute-style access (e.g., settings.KEY), not dictionary-style (settings['KEY']). Mixing the two can lead to AttributeError.
fix
Always use attribute access (settings.KEY) instead of dict access (settings['KEY']).
affects: >=0.1.0
gotchaSettingsHolder is not thread-safe for simultaneous writes. Concurrent attribute modifications may cause race conditions.
fix
Use locks or avoid concurrent writes to the same SettingsHolder instance.
affects: >=0.1.0
gotchaIn Python >=3.10, attribute names that conflict with built-in object attributes (e.g., 'items', 'keys') will be silently overridden by the SettingsHolder, potentially causing unexpected behavior.
fix
Avoid setting attribute names that shadow object methods (like 'items', 'keys', 'values').
affects: >=0.1.0
Errors
Common errors & fixes
AttributeError: 'SettingsHolder' object has no attribute 'NONEXISTENT'
Trying to access a setting that hasn't been set or is not in defaults.
fix
Ensure the setting is defined via defaults or assigned before access. Use setattr or check with hasattr.
TypeError: 'SettingsHolder' object does not support item assignment
Trying to use dict-style assignment settings['KEY'] = value
fix
Use attribute assignment: settings.KEY = value
Upgrade
Version history
0.3.0latest on PyPI · released Apr 27, 2025
Audit
Dependencies

No dependency data recorded yet.

Agent activity
9 hits · last 30 days
node
8
Resources
django-settings-holder — pip install django-settings-holder · libregistry