A simple Django app to store and retrieve application settings in the database
Project description
django-settings2
A simple Django app to store and retrieve application settings in the database.
Requirements
- Python >= 3.6
- Django >= 3.2
Installation
pip install django-settings2
Configuration
Add to INSTALLED_APPS
INSTALLED_APPS = [
...
"django_settings2",
]
Run migrations
python manage.py migrate
Usage
from django_settings2.models import DjangoSettings
# Store a value
DjangoSettings.set_value("my_key", "hello")
DjangoSettings.set_value("max_retries", 5, cls=int)
DjangoSettings.set_value("threshold", 0.75, cls=float)
# Retrieve a value
value = DjangoSettings.get_value("my_key", default="fallback")
# Retrieve a JSON value stored as text
data = DjangoSettings.get_value_json("my_json_key", default={})
# Retrieve with row-level lock (useful in transactions)
data = DjangoSettings.get_value_json("my_json_key", lock=True)
License
MIT
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 Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file django_settings2-1.0.0.tar.gz.
File metadata
- Download URL: django_settings2-1.0.0.tar.gz
- Upload date:
- Size: 3.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
10ef98342f22ee66a5efb9adc4885a10d0193794705d912ea4c19d2610d3d2ff
|
|
| MD5 |
06f6c6860864e903266f8bc8c8bda6b4
|
|
| BLAKE2b-256 |
0df52259d965b793ddfe2a0aa2da1d35435c3caf456b9ab60ef57d25e628bb6b
|
File details
Details for the file django_settings2-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_settings2-1.0.0-py3-none-any.whl
- Upload date:
- Size: 5.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.10.17
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
59bb746fd3c57d4fb1e3aaa10cc1b555a565c0067d0cb034621513887e6d9e69
|
|
| MD5 |
41e6e6ea30b7429472f537d40188b044
|
|
| BLAKE2b-256 |
c69679a670c3125464d7461b30d43b242a05f04422244b0d821a7274b7f9ff52
|