Skip to main content

Logo

License: MIT Version: 1.1.6 Ruff pyrefly PyPI PyPI pyversions PyPI djversions PyPI status PyPI - Downloads PyPI - Types


Tests pre-commit.ci status


Documentation: https://django-gc.rdd-lab.com/

Source Code: https://github.com/RDDLab/Django-GlobalConfig


Django-GC

Django-GC stores typed runtime settings in the database and uses a shared cache when configured. Application code never reads a value through the ORM. The project owns the keys; this package is the mechanism.

Features

  • Code-declared keys — categories and definitions live in Django settings and are synchronized by initialize_global_configs.
  • Typed values — strings, numbers, dates, arrays, choices, JSON, UUID, and optional secure secrets.
  • Targeted cache updates — saving one setting refreshes only its typed cache entry.
  • Full recovery snapshot — a miss in a shared cache rebuilds the snapshot.
  • Direct database reads — local-memory and dummy caches use current values from the database.
  • Stock Django Admin — edit values with standard ModelAdmin and Django's built-in change history.
  • Optional Celery — periodic full snapshot refresh.
  • Fully typed — ships py.typed; compatible with pyrefly and standard type checkers.

Requirements

Python Minimum Django
3.12, 3.13, 3.14 6.0
3.15 6.1.3

Installation

pip install 'django-gc>=1.1.6'
INSTALLED_APPS = [
    'django_gc',
    'django.contrib.admin',
    # ...
]

Periodic refresh is optional:

pip install 'django-gc[celery]'

Quick start

Declare categories and keys in Django settings. Set the encryption key through your deployment configuration before using SECURE values.

from enum import StrEnum

from django_gc import (
    CategoryDefinition,
    SettingDefinition,
    SettingType,
)


class SettingKey(StrEnum):
    MAINTENANCE_ENABLED = 'platform.maintenance_enabled'


GLOBAL_CONFIG_CATEGORIES = [
    CategoryDefinition(id=1, code='platform', name='Platform'),
]
GLOBAL_CONFIG_DEFINITIONS = [
    SettingDefinition(
        key=SettingKey.MAINTENANCE_ENABLED,
        description='Maintenance mode',
        default_value=False,
        value_type=SettingType.BOOLEAN,
        category_id=1,
    ),
]
python manage.py migrate
python manage.py initialize_global_configs

After Django has initialized, use the runtime API from application code.

from django_gc import get_value, set_typed_value

enabled = get_value("platform.maintenance_enabled")
set_typed_value(key="platform.maintenance_enabled", value=True)

Documentation

Getting started · Upgrade and operations · Documentation deployment

После создания схемы и при обновлении definitions выполните uv run python manage.py initialize_global_configs. Миграции не создают категории и значения GC. Существующие значения сохраняются.

The metadata template uses the standard Django template loader. Project templates may override its logical name.

Metadata

Release files for django-gc 1.1.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for django-gc 1.1.6
File Size Uploaded Provenance Actions
django_gc-1.1.6.tar.gz 55.4 kB With provenance Details for django_gc-1.1.6.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for django-gc 1.1.6
File Interpreter ABI Platform Actions
django_gc-1.1.6-py3-none-any.whl Python 3 none any Details for django_gc-1.1.6-py3-none-any.whl

Total release size: 111.7 kB

Release files / django_gc-1.1.6.tar.gz

Download URL django_gc-1.1.6.tar.gz
Size 55.4 kB
Tags Source
SHA-256 checksum
How to use checksums
77b43f23ef0d991423008031209cbff874358b72b587b7446e86d4ac69bdb687
BLAKE2b-256 checksum
How to use checksums
decc17d9cf3bc58c4a7b99cef054b7b5a74df088c5e589da66b723284e7041a5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Release files / django_gc-1.1.6-py3-none-any.whl

Download URL django_gc-1.1.6-py3-none-any.whl
Size 56.2 kB
Tags Python 3
SHA-256 checksum
How to use checksums
120e79f10a9dafb6525981c373a7b79ee5b510e7bc7bc0015f7e1eab1928617e
BLAKE2b-256 checksum
How to use checksums
c5ff8e917ed029904e3aebfaaa95647dccd4c4886d56a1a1784d8dc469483e72
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

Security for django-gc 1.1.6

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for django_gc-1.1.6.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 26, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page