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.
  • Full cache snapshotget_value() never falls back to a single-row ORM read.
  • 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.2.tar.gz (30.0 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.2-py3-none-any.whl (32.9 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: django_gc-1.0.2.tar.gz
  • Upload date:
  • Size: 30.0 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.2.tar.gz
Algorithm Hash digest
SHA256 168c5d04bfb1cbf41bd3d155f9dbb14749e93f198c747d4e00d32efae969d254
MD5 c1a73b6a1463522d923a7fbe14791434
BLAKE2b-256 224eb6caace16fb834cf9e396ddac312957bde2c5a7c68268015b9942254543d

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gc-1.0.2.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.2-py3-none-any.whl.

File metadata

  • Download URL: django_gc-1.0.2-py3-none-any.whl
  • Upload date:
  • Size: 32.9 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 ac02be2b41c8a2ed780c965cad13d420edee9a55dcbc9bbbba544d5ab62e69e9
MD5 12a7b1bbb31ba580cc6539104fcc4329
BLAKE2b-256 9b43437be908245bfebddb29e7522ba8bb46b486b23e790d7f92744f22237af0

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_gc-1.0.2-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.2 This release

2 files

1.0.1

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page