Hello all! π
TL;DR I created a runtime configuration Django app called django-sysconfig.
Here's the problem that led me to build it. We all tend to bloat the settings.py and .env files to store all these secrets and other API URLs for 3rd-party integrations. This approach requires the server restart on each change to .env file, and also this is not a scalable solution.
The Solution
django-sysconfig is a schema-driven database-backed typed runtime configuration app for Django. This app has in-built cache support (using Django Cache Framework) with a simple Admin UI to allow non-IT admins to easily manage the project configurations.
Some features of this app:
- Validations (email, url, ip, port, hostname, min-max, regex, etc. Each config value will be validated before saving to DB)
- A clean Admin UI to manage configurations.
- Schema based config. Your schema updates as your app grows and is distributed across your apps instead of a single place)
-
on_savecallbacks for each config (helpful for DevOps notifications) - CLI management command to manage configs through cli.
- Runtime typed. The values are automatically converted to the field defined type.
- Secrets. Store secrets securely in DB (encrypted) and are decrypted when used in code.
This app is built to be extended from the core. You don't like the admin UI. Make your own the core config API and simple templates. Need new validators or new config Field types? Create your own very easily.
How does it compare?
| Feature | django-sysconfig β | django-constance | django-dynamic-preferences |
|---|---|---|---|
| Schema definition |
sysconfig.py per app, auto-discovered |
CONSTANCE_CONFIG dict in settings.py
|
Decorated Python class, registered manually |
| Storage | Database | Redis, Database, or Memory | Database |
| Caching | β No expiry, invalidated on write. | β Redis TTL or DB cache backend | β Django cache, invalidated on write |
| Typed fields | β String, Int, Decimal, Bool, Select, Textarea, Secret | Basic β custom types via CONSTANCE_ADDITIONAL_FIELDS
|
β Bool, String, Int, Float, Choice, File, ModelChoiceβ¦ |
| Built-in validators | β 20 β email, URL, IP, range, regex, slug, JSON, portβ¦ | β | Basic form field validation only |
| Encryption at rest | β
SecretFrontendModel (Fernet AES-128 + HMAC) |
β | β |
| on_save callback | β Per-field, fires after DB write + cache update | β | β |
| Management CLI | β
get, set, reset, export, import (with --dry-run, --force, --skip-on-save-callbacks) |
β | β |
| Per-user / instance settings | β Global only | β Global only | β Global + per-user/model |
| Admin UI | Custom staff-only views at /admin/config/
|
Standard Django admin (flat list) | Standard Django admin (grouped by section) |
| Accessing values | config.get("app.section.field") |
config.SETTING_NAME |
global_preferences["section__name"] |
| REST API | β | β | β Optional, DRF-based |
| Min Python / Django | Python 3.11 / Django 4.2 | Python 3.x / Django 3.2 | Python 3.6 / Django 3.2 |
| Maturity | π Early stage | π Mature, Jazzband-maintained | β Stable, active community |
I've recently released the v1.0.0 to PyPi. Feel free to try it out. Would love your feedback on this.
GitHub Repo: https://github.com/krishnamodepalli/django-sysconfig
Docs: https://krishnamodepalli.github.io/django-sysconfig/

Top comments (0)