Skip to main content

A Django package for managing typed settings via Unfold admin with strict validation and cached JSON API output.

Project description

Django Unfold Settings

GitHub

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 TabularInline components.
  • 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

  1. Install the package:
pip install django-unfold-settings
  1. Add unfold and unfold_settings to INSTALLED_APPS in settings.py:
INSTALLED_APPS = [
    "unfold",
    "unfold_settings",
    # ...
]
  1. Run migrations:
python manage.py migrate
  1. 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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

django_unfold_settings-1.0.0.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_unfold_settings-1.0.0-py3-none-any.whl (10.4 kB view details)

Uploaded Python 3

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

Hashes for django_unfold_settings-1.0.0.tar.gz
Algorithm Hash digest
SHA256 05dbad8567e06492df19ef7481438bb2b444565c2cff3a597ec9253cdf03db33
MD5 a3c5c049e96b6dbdd9ee798cad3ba831
BLAKE2b-256 d517925c90d56462ce3db7cb395a431321af65f5b21971289079c4ecbaacae4c

See more details on using hashes here.

File details

Details for the file django_unfold_settings-1.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_unfold_settings-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 f64189f9fd3dd1e235d368034f46d6b2c72fdf84d6d0c42d4168a30ec345fcc3
MD5 a13c5ac306d07cf03c0c88a590249e2a
BLAKE2b-256 c11a6701abc85e92697bc78f78e3eb37a61093e1535fa78e2df5bfb68cda8dcd

See more details on using hashes here.

Supported by

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