Skip to main content

Logo

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


Tests Codecov pre-commit.ci status


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

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


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 after migrate.
  • 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 snapshotget_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.

Installation

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

Periodic refresh is optional:

pip install 'django-gc[celery]'

Quick start

In Django settings, set categories, keys, and the encryption key. Then migrate and read values through the service:

from enum import StrEnum

from django_gc import (
    CategoryDefinition,
    SettingDefinition,
    SettingType,
    get_value,
    set_value,
)


class SettingKey(StrEnum):
    MAINTENANCE_ENABLED = '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,
    ),
]
GLOBAL_CONFIG_ENCRYPTION_KEY = 'replace-with-a-long-random-secret'

enabled = get_value(SettingKey.MAINTENANCE_ENABLED)
set_value(SettingKey.MAINTENANCE_ENABLED, True)

Documentation

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

Download files

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

Source Distribution

django_gc-1.0.3.tar.gz (30.6 kB view details)

Uploaded Source

Built Distribution

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

django_gc-1.0.3-py3-none-any.whl (33.2 kB view details)

Uploaded Python 3

File details

Details for the file django_gc-1.0.3.tar.gz.

File metadata

  • Download URL: django_gc-1.0.3.tar.gz
  • Upload date:
  • Size: 30.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_gc-1.0.3.tar.gz
Algorithm Hash digest
SHA256 ca753223e95c68f1a34b37c40b2122bc203d6a969bcd6b442a60302613c9f86e
MD5 e782f0f0db26cd01402f011f58c0747b
BLAKE2b-256 6ca8cd67530323650e010c9ba10a8fa0a4445c21e9922d5831bb0640be52c85f

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gc-1.0.3.tar.gz:

Publisher: publish.yml on RDDLab/Django-GC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_gc-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: django_gc-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 33.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for django_gc-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1e02272dc6a45b304366e38ca357de74ccc60a279fafe99b34dbd61558bebe56
MD5 bdeb102fdd1371101087a50440864f6b
BLAKE2b-256 c3c553167301f7793f3ad1dcd3bb869608cdb8e34612d5d020c4904ade11d554

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gc-1.0.3-py3-none-any.whl:

Publisher: publish.yml on RDDLab/Django-GC

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

1.0.3 This release

2 files

1.0.2

2 files

1.0.1

2 files

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