Skip to main content

Django integration plugin for PyConfBox

Project description

PyConfBox Django Plugin

Django integration plugin for PyConfBox configuration management

This plugin enables seamless integration of PyConfBox with Django applications, providing automatic synchronization with Django settings and middleware support.

한국어 문서: README_ko.md | English Documentation: README.md (current)

🚀 Installation

pip install pyconfbox-django

📋 Requirements

  • Python 3.8+
  • Django 3.2+
  • pyconfbox >= 0.1.0

🔧 Configuration

Add Middleware to Django Settings

# settings.py
MIDDLEWARE = [
    'pyconfbox_django.middleware.PyConfBoxMiddleware',
    # ... other middleware
]

# PyConfBox configuration
PYCONFBOX = {
    'default_storage': 'environment',
    'fallback_storage': 'memory',
    'env_prefix': 'DJANGO_',
}

💡 Usage

Django Storage Backend

from pyconfbox_django import DjangoStorage
from pyconfbox import Config

# Integrate with Django settings
django_storage = DjangoStorage()
config = Config(default_storage=django_storage)

# Automatically reflects to Django settings
config.set('DEBUG', True, scope='django')
config.set('SECRET_KEY', 'your-secret-key', scope='django')
config.set('ALLOWED_HOSTS', ['localhost', '127.0.0.1'], scope='django')

Accessing Django Settings

from pyconfbox_django import get_django_config

# Get Django-specific configuration
django_config = get_django_config()

# Access Django settings through PyConfBox
debug_mode = django_config.get('DEBUG')
secret_key = django_config.get('SECRET_KEY')

Middleware Features

The PyConfBox middleware provides:

  • Automatic configuration loading on request start
  • Configuration context available in views
  • Environment variable synchronization
  • Settings validation and type conversion

Advanced Configuration

# settings.py
PYCONFBOX = {
    'default_storage': 'environment',
    'fallback_storage': 'memory',
    'env_prefix': 'DJANGO_',
    'auto_sync': True,  # Automatically sync with Django settings
    'validate_settings': True,  # Validate Django settings
    'cache_timeout': 300,  # Cache timeout in seconds
}

🎯 Features

  • 🔄 Auto-sync: Automatic synchronization with Django settings
  • 🔧 Middleware: Request-level configuration management
  • 🎯 Scope Support: Django-specific configuration scope
  • 🔒 Type Safety: Automatic type validation and conversion
  • ⚡ Performance: Efficient caching and lazy loading

📖 Documentation

🔗 Related Packages

🤝 Contributing

Contributions are welcome! Please see our Contributing Guide for details.

📄 License

MIT License - See the LICENSE file for details.


Enhance your Django applications with PyConfBox! 🚀

Project details


Download files

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

Source Distribution

pyconfbox_django-0.1.1.tar.gz (56.4 kB view details)

Uploaded Source

Built Distribution

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

pyconfbox_django-0.1.1-py3-none-any.whl (7.1 kB view details)

Uploaded Python 3

File details

Details for the file pyconfbox_django-0.1.1.tar.gz.

File metadata

  • Download URL: pyconfbox_django-0.1.1.tar.gz
  • Upload date:
  • Size: 56.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.5

File hashes

Hashes for pyconfbox_django-0.1.1.tar.gz
Algorithm Hash digest
SHA256 73316e90e6b173e3761fdc200d9f25e81393c2eb20ceeac70a83dd5aaf393dbb
MD5 ca04f9eb73a33cd2fd1572a9008fba58
BLAKE2b-256 69ddc0172dd8055ee39508e33ef7f68c9cc655e582c93d291e5ac4e90194df2e

See more details on using hashes here.

File details

Details for the file pyconfbox_django-0.1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pyconfbox_django-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 31d6e3796f8f500f704b745c879da1657c9597ec623bde6202d6a198c75fc247
MD5 2ca8767dac02c56fe9f76720d2536001
BLAKE2b-256 30e7a502616369b426d7af6b8f081a1331423f0b2c1a1ab0296f796e32ec50ac

See more details on using hashes here.

Supported by

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