Skip to content

krishnamodepalli/django-sysconfig

Repository files navigation

django-sysconfig

PyPI version Python versions CI License

Schema-driven, database-backed runtime configuration for Django.

Define typed config fields in code. Store values in the database. Edit everything live through a built-in admin UI — without touching settings.py.

django-sysconfig demo


Install

pip install django-sysconfig
# settings.py
INSTALLED_APPS = [
    "django_sysconfig",   # add at the top
    ...
]
python manage.py migrate

Quick example

# myapp/sysconfig.py
from django_sysconfig.registry import register_config, Section, Field
from django_sysconfig.frontend_models import BooleanFrontendModel, IntegerFrontendModel
from django_sysconfig.validators import RangeValidator

@register_config("myapp")
class MyAppConfig:
    class General(Section):
        label = "General"

        maintenance_mode = Field(BooleanFrontendModel, label="Maintenance Mode", default=False)
        max_items = Field(IntegerFrontendModel, label="Max Items", default=100,
                          validators=[RangeValidator(min_value=1, max_value=10_000)])
# anywhere in your project
from django_sysconfig.accessor import config

if config.get("myapp.general.maintenance_mode"):
    return HttpResponse("Down for maintenance.", status=503)

Staff can toggle maintenance_mode at /admin/config/ — no code change, no redeploy.


Documentation

Full guides, API reference, and examples are in the docs.


Contributing

See CONTRIBUTING.md. Issues and pull requests are welcome.


Security

Please do not open a public issue for security vulnerabilities. Report them privately via GitHub Security Advisories.