django-dynamicsettings
Django app to allow (chosen) settings to be configurable through django admin (or anything that updates the Settings model).
Usage
In your settings.py (or whatever DJANGO_SETTINGS_MODULE you are using), simply change:
MIGHTY_SETTING = 'boring_setting_requires_deploy'
to
from dynamicsettings import DynamicSetting as DYN
MIGHTY_SETTING = DYN('boring_setting_requires_deploy')
And done. MIGHT_SETTING value can now be changed using dynsetting.Setting model (registered in django-admin).
DynamicSetting class caches the values from database as, quite often, the settings are accessed many times in the same loop.
There is CACHE_TTL setting to control it (default being 1 second).
To change it simply put
from dynamicsettings import DynamicSetting as DYN
DYN.CACHE_TTL = 30
in that same settings module. 0 disables cache entirely (not recommended).
Alternatives
https://django-dynamic-preferences.readthedocs.io/en/latest/ seems like a popular solution to this problem but it solves it differently.
You need to register the settings with those decorators while with dynamicsettings you just add an helper to your usual settings.py definition and everything should seamlessly works!
Metadata
Release files for django-dynamicsettings 0.0.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| django-dynamicsettings-0.0.3.tar.gz | 6.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| django_dynamicsettings-0.0.3-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 14.5 kB
Release files / django-dynamicsettings-0.0.3.tar.gz
| Download URL | django-dynamicsettings-0.0.3.tar.gz |
|---|---|
| Size | 6.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
3c7cc95a6a99e61dccd7b9c371a1f60826a5e36453a903d7e9e4f9dbdf543a4b
|
|
BLAKE2b-256 checksum How to use checksums |
95d9409d72832d0321709423ca6d00f5e4378ed040ed81bfe6329b4491122bb8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|
Release files / django_dynamicsettings-0.0.3-py3-none-any.whl
| Download URL | django_dynamicsettings-0.0.3-py3-none-any.whl |
|---|---|
| Size | 7.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
cecff91178c460b6ab0b9c38b0fcea452b2bd01b97e0d3f5c2ad7c3385494d6a
|
|
BLAKE2b-256 checksum How to use checksums |
68fd816af05f10f3eee33837be87f4739220edd912d94dfd4cb9cc820eaff93c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.2 CPython/3.9.5
|