A Django package for managing typed settings via Unfold admin with strict validation and cached JSON API output.
Project description
Django Unfold Settings
A reusable Django package for managing global application settings with multiple data types via the modern django-unfold admin interface. Features strict validation, automated cache management, and a high-performance flat JSON API.
Features
- Strict Type Validation: EAV-inspired architecture with dedicated tables for each data type (
string,text,html,bool,json,date,datetime,file). - Unfold Admin Integration: Responsive UI using Unfold
TabularInlinecomponents. - High Performance: Optimized querying fetches all configs in exactly 1 SQL query.
- Automated Caching: Built-in cache layer with dynamic TTL and instant invalidation via signals.
Requirements
- Python >= 3.10
- Django >= 4.2
- django-unfold >= 0.20.0
Installation
- Install the package:
pip install django-unfold-settings
- Add
unfoldandunfold_settingstoINSTALLED_APPSinsettings.py:
INSTALLED_APPS = [
"unfold",
"unfold_settings",
# ...
]
- Run migrations:
python manage.py migrate
- Include the API routing in your core
urls.py:
from django.urls import path, include
urlpatterns = [
path("api/settings/", include("unfold_settings.urls")),
]
Cache Configuration
You can control the API cache lifetime in settings.py:
# Cache timeout in seconds (Default: 3600 / 1 hour)
APP_SETTINGS_CACHE_TTL = 7200
# Disable caching completely
APP_SETTINGS_CACHE_TTL = 0
API Output
The endpoint /api/settings/settings/ returns a flat JSON dictionary:
{
"SITE_NAME": "My App",
"MAINTENANCE_MODE": false,
"CONFIG": {"api_key": "12345"},
"PROJECT_LOGO": "/media/uploads/settings/LOGO/logo.png"
}
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_unfold_settings-1.0.0.tar.gz.
File metadata
- Download URL: django_unfold_settings-1.0.0.tar.gz
- Upload date:
- Size: 7.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
05dbad8567e06492df19ef7481438bb2b444565c2cff3a597ec9253cdf03db33
|
|
| MD5 |
a3c5c049e96b6dbdd9ee798cad3ba831
|
|
| BLAKE2b-256 |
d517925c90d56462ce3db7cb395a431321af65f5b21971289079c4ecbaacae4c
|
File details
Details for the file django_unfold_settings-1.0.0-py3-none-any.whl.
File metadata
- Download URL: django_unfold_settings-1.0.0-py3-none-any.whl
- Upload date:
- Size: 10.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.14.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f64189f9fd3dd1e235d368034f46d6b2c72fdf84d6d0c42d4168a30ec345fcc3
|
|
| MD5 |
a13c5ac306d07cf03c0c88a590249e2a
|
|
| BLAKE2b-256 |
c11a6701abc85e92697bc78f78e3eb37a61093e1535fa78e2df5bfb68cda8dcd
|