Skip to main content

Logo

License: MIT Version: 1.1.5 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 serves them from Django's cache. 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 — get_value() never falls back to a single-row ORM read on cache miss.
  • 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.5'
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.5

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.5
File Size Uploaded Provenance Actions
django_gc-1.1.5.tar.gz 54.5 kB With provenance Details for django_gc-1.1.5.tar.gz

Built distribution (wheel)

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

Total release size: 110.5 kB

Release files / django_gc-1.1.5.tar.gz

Download URL django_gc-1.1.5.tar.gz
Size 54.5 kB
Tags Source
SHA-256 checksum
How to use checksums
0769ec26f1323f67cefd80f72ad550b593b761144e6422203d3f104610a58f67
BLAKE2b-256 checksum
How to use checksums
17323b473178914a3325daedc13c31f8996175f5852b391904e1d9991a0c6062
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 25, 2026.

Transparency log

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

Download URL django_gc-1.1.5-py3-none-any.whl
Size 56.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b6ad9923d14bf53f034525a9082575865ee7f69ab9f5618acc6cbc8952f7f0a4
BLAKE2b-256 checksum
How to use checksums
147225adf51eec5b183a5831bc85ffb4d9d2df86fc66744a33bf16731c71f4bf
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 25, 2026.

Transparency log

Security for django-gc 1.1.5

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.5.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 25, 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