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
- pyconfbox - Main PyConfBox package
- pyconfbox-mysql - MySQL storage backend
- pyconfbox-postgresql - PostgreSQL storage backend
- pyconfbox-mongodb - MongoDB storage backend
🤝 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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyconfbox_django-0.1.2.tar.gz.
File metadata
- Download URL: pyconfbox_django-0.1.2.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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b78ad0bd4883e83fa1bacab0647330a9b4716d0bb548876e8dcd9f9e23d8bcc2
|
|
| MD5 |
410a7da73c8e0d53ab030452de1a8f1c
|
|
| BLAKE2b-256 |
c9c7fb64ba8e01efce43d49d6c1a64e1063825d2840a2985996cd6a02e20e2cd
|
File details
Details for the file pyconfbox_django-0.1.2-py3-none-any.whl.
File metadata
- Download URL: pyconfbox_django-0.1.2-py3-none-any.whl
- Upload date:
- Size: 7.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.13.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
36a9e76a29a799b78f7656848db596b8bce2aab4f1795bfac86ca757bc0642c9
|
|
| MD5 |
51988ece4880a15404b644638e202a24
|
|
| BLAKE2b-256 |
f14836fc16648181471c21547b2395a48564b80f35ae3525707fa5183ed6d045
|