django-cfg 1.1.62__py3-none-any.whl → 1.1.63__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- django_cfg/__init__.py +1 -1
- {django_cfg-1.1.62.dist-info → django_cfg-1.1.63.dist-info}/METADATA +145 -4
- {django_cfg-1.1.62.dist-info → django_cfg-1.1.63.dist-info}/RECORD +6 -6
- {django_cfg-1.1.62.dist-info → django_cfg-1.1.63.dist-info}/WHEEL +0 -0
- {django_cfg-1.1.62.dist-info → django_cfg-1.1.63.dist-info}/entry_points.txt +0 -0
- {django_cfg-1.1.62.dist-info → django_cfg-1.1.63.dist-info}/licenses/LICENSE +0 -0
django_cfg/__init__.py
CHANGED
@@ -38,7 +38,7 @@ default_app_config = "django_cfg.apps.DjangoCfgConfig"
|
|
38
38
|
from typing import TYPE_CHECKING
|
39
39
|
|
40
40
|
# Version information
|
41
|
-
__version__ = "1.1.
|
41
|
+
__version__ = "1.1.63"
|
42
42
|
__author__ = "Unrealos Team"
|
43
43
|
__email__ = "info@unrealos.com"
|
44
44
|
__license__ = "MIT"
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: django-cfg
|
3
|
-
Version: 1.1.
|
3
|
+
Version: 1.1.63
|
4
4
|
Summary: 🚀 Production-ready Django configuration framework with type-safe settings, smart automation, and modern developer experience
|
5
5
|
Project-URL: Homepage, https://github.com/markolofsen/django-cfg
|
6
6
|
Project-URL: Documentation, https://django-cfg.readthedocs.io
|
@@ -173,7 +173,7 @@ python manage.py runserver
|
|
173
173
|
- ✅ **Newsletter campaigns** with email tracking
|
174
174
|
- ✅ **Lead management** system with CRM integration
|
175
175
|
- ✅ **Multi-database routing** and connection pooling
|
176
|
-
- ✅ **Background task processing** with Dramatiq
|
176
|
+
- ✅ **Background task processing** with production-ready Dramatiq integration
|
177
177
|
- ✅ **Webhook testing** with built-in ngrok integration
|
178
178
|
- ✅ **Type-safe configuration** with full IDE support
|
179
179
|
|
@@ -413,8 +413,137 @@ Automatic dev/staging/production detection with appropriate defaults.
|
|
413
413
|
### 🌐 **Built-in Ngrok Integration**
|
414
414
|
Instant webhook testing with zero-config ngrok tunnels for development.
|
415
415
|
|
416
|
-
### 🔄 **Background Task Processing**
|
417
|
-
|
416
|
+
### 🔄 **Background Task Processing** %%PRIORITY:HIGH%%
|
417
|
+
|
418
|
+
Django-CFG includes a complete Dramatiq integration for reliable background job processing with automatic Redis configuration, worker management, and task monitoring.
|
419
|
+
|
420
|
+
#### Features
|
421
|
+
- **🚀 Zero Configuration** - Automatic Redis broker setup and queue management
|
422
|
+
- **⚡ Smart Worker Management** - Built-in `rundramatiq` command with Django settings integration
|
423
|
+
- **🔧 Type-Safe Task Definition** - Full IDE support for task creation and scheduling
|
424
|
+
- **📊 Task Monitoring** - Built-in commands for queue status and task management
|
425
|
+
- **🐳 Docker Ready** - Pre-configured Docker containers for production deployment
|
426
|
+
- **🛡️ Production Tested** - Battle-tested configuration used in production environments
|
427
|
+
|
428
|
+
#### Quick Setup
|
429
|
+
```python
|
430
|
+
from django_cfg import DjangoConfig
|
431
|
+
|
432
|
+
class MyConfig(DjangoConfig):
|
433
|
+
project_name: str = "My App"
|
434
|
+
|
435
|
+
# Dramatiq configuration (automatic)
|
436
|
+
redis_url: str = "redis://localhost:6379/2" # Separate DB for tasks
|
437
|
+
|
438
|
+
# Optional: Custom task settings
|
439
|
+
dramatiq: DramatiqConfig = DramatiqConfig(
|
440
|
+
processes=2, # Worker processes
|
441
|
+
threads=4, # Threads per process
|
442
|
+
redis_db=2, # Redis database for tasks
|
443
|
+
queues=["default", "high", "low"] # Available queues
|
444
|
+
)
|
445
|
+
|
446
|
+
config = MyConfig()
|
447
|
+
```
|
448
|
+
|
449
|
+
#### Task Definition
|
450
|
+
```python
|
451
|
+
import dramatiq
|
452
|
+
from django_cfg.modules.django_tasks import get_broker
|
453
|
+
|
454
|
+
# Tasks are automatically discovered from your apps
|
455
|
+
@dramatiq.actor(queue_name="high", max_retries=3)
|
456
|
+
def process_document(document_id: str) -> dict:
|
457
|
+
"""Process document asynchronously with full Django context."""
|
458
|
+
from myapp.models import Document
|
459
|
+
|
460
|
+
document = Document.objects.get(id=document_id)
|
461
|
+
# Your processing logic here
|
462
|
+
document.status = "processed"
|
463
|
+
document.save()
|
464
|
+
|
465
|
+
return {"status": "completed", "document_id": document_id}
|
466
|
+
|
467
|
+
# Queue the task
|
468
|
+
process_document.send(document_id="123")
|
469
|
+
```
|
470
|
+
|
471
|
+
#### Management Commands
|
472
|
+
```bash
|
473
|
+
# Start Dramatiq workers with Django settings
|
474
|
+
python manage.py rundramatiq --processes 4 --threads 8
|
475
|
+
|
476
|
+
# Monitor task queues and status
|
477
|
+
python manage.py task_status --queue high
|
478
|
+
|
479
|
+
# Clear specific queues
|
480
|
+
python manage.py task_clear --queue default
|
481
|
+
|
482
|
+
# Test task processing pipeline
|
483
|
+
python manage.py test_tasks
|
484
|
+
```
|
485
|
+
|
486
|
+
#### Docker Integration
|
487
|
+
```yaml
|
488
|
+
# docker-compose.yml (automatically generated)
|
489
|
+
services:
|
490
|
+
app-dramatiq:
|
491
|
+
build: .
|
492
|
+
command: ["python", "manage.py", "rundramatiq"]
|
493
|
+
environment:
|
494
|
+
- DRAMATIQ_PROCESSES=2
|
495
|
+
- DRAMATIQ_THREADS=4
|
496
|
+
- DRAMATIQ_QUEUES=default,high,low
|
497
|
+
depends_on:
|
498
|
+
- redis
|
499
|
+
- postgres
|
500
|
+
```
|
501
|
+
|
502
|
+
#### Production Features
|
503
|
+
- **🔄 Automatic Restart** - Workers restart on code changes in development
|
504
|
+
- **📈 Scaling** - Easy horizontal scaling with multiple worker containers
|
505
|
+
- **🛡️ Error Handling** - Built-in retry logic and dead letter queues
|
506
|
+
- **📊 Monitoring** - Integration with Django admin for task monitoring
|
507
|
+
- **⚡ Performance** - Optimized Redis configuration for high throughput
|
508
|
+
|
509
|
+
#### Real-World Example
|
510
|
+
```python
|
511
|
+
# Document processing pipeline
|
512
|
+
@dramatiq.actor(queue_name="knowledge", max_retries=2)
|
513
|
+
def process_document_async(document_id: str) -> dict:
|
514
|
+
"""Complete document processing with chunking and embeddings."""
|
515
|
+
try:
|
516
|
+
document = Document.objects.get(id=document_id)
|
517
|
+
|
518
|
+
# Step 1: Chunk document
|
519
|
+
chunks = create_document_chunks(document)
|
520
|
+
|
521
|
+
# Step 2: Generate embeddings
|
522
|
+
for chunk in chunks:
|
523
|
+
generate_embeddings.send(chunk.id)
|
524
|
+
|
525
|
+
# Step 3: Optimize database
|
526
|
+
optimize_document_embeddings.send(document_id)
|
527
|
+
|
528
|
+
return {"status": "completed", "chunks_created": len(chunks)}
|
529
|
+
|
530
|
+
except Exception as e:
|
531
|
+
logger.error(f"Document processing failed: {e}")
|
532
|
+
return {"status": "failed", "error": str(e)}
|
533
|
+
|
534
|
+
# Triggered automatically via Django signals
|
535
|
+
@receiver(post_save, sender=Document)
|
536
|
+
def queue_document_processing(sender, instance, created, **kwargs):
|
537
|
+
if created:
|
538
|
+
process_document_async.send(str(instance.id))
|
539
|
+
```
|
540
|
+
|
541
|
+
**Perfect for:**
|
542
|
+
- 📄 **Document Processing** - PDF parsing, text extraction, embeddings
|
543
|
+
- 📧 **Email Campaigns** - Bulk email sending with delivery tracking
|
544
|
+
- 🔄 **Data Synchronization** - API integrations and data imports
|
545
|
+
- 📊 **Report Generation** - Heavy computational tasks
|
546
|
+
- 🧹 **Cleanup Tasks** - Database maintenance and optimization
|
418
547
|
|
419
548
|
---
|
420
549
|
|
@@ -444,6 +573,7 @@ Django-CFG includes powerful management commands for development and operations:
|
|
444
573
|
| **`rundramatiq`** | Run Dramatiq background task workers | `python manage.py rundramatiq --processes 4` |
|
445
574
|
| **`task_status`** | Show Dramatiq task status and queues | `python manage.py task_status --queue high` |
|
446
575
|
| **`task_clear`** | Clear Dramatiq queues | `python manage.py task_clear --queue default` |
|
576
|
+
| **`test_tasks`** | Test Dramatiq task processing pipeline | `python manage.py test_tasks --document-id 123` |
|
447
577
|
| **`tree`** | Display Django project structure | `python manage.py tree --depth 3 --include-docs` |
|
448
578
|
| **`validate_config`** | Deep validation of all settings | `python manage.py validate_config --strict` |
|
449
579
|
|
@@ -955,6 +1085,17 @@ class ProductionConfig(DjangoConfig):
|
|
955
1085
|
enable_newsletter: bool = True # Email marketing, campaigns, tracking & analytics
|
956
1086
|
enable_leads: bool = True # Lead capture, CRM integration, source tracking
|
957
1087
|
|
1088
|
+
# === Background Task Processing ===
|
1089
|
+
redis_url: str = "redis://redis:6379/2" # Separate DB for Dramatiq tasks
|
1090
|
+
dramatiq: DramatiqConfig = DramatiqConfig(
|
1091
|
+
processes=4, # Production worker processes
|
1092
|
+
threads=8, # Threads per process for I/O bound tasks
|
1093
|
+
redis_db=2, # Dedicated Redis DB for task queues
|
1094
|
+
queues=["default", "high", "low", "knowledge", "email"], # Production queues
|
1095
|
+
max_retries=3, # Default retry attempts
|
1096
|
+
max_age=3600000, # 1 hour max task age (milliseconds)
|
1097
|
+
)
|
1098
|
+
|
958
1099
|
# === Multi-Zone API ===
|
959
1100
|
revolution: RevolutionConfig = RevolutionConfig(
|
960
1101
|
api_prefix="api/v2",
|
@@ -1,4 +1,4 @@
|
|
1
|
-
django_cfg/__init__.py,sha256=
|
1
|
+
django_cfg/__init__.py,sha256=L7If-rI58bv1bXS1v_0LJYjhiBMJIcXlZQdscCSVMrs,14288
|
2
2
|
django_cfg/apps.py,sha256=k84brkeXJI7EgKZLEpTkM9YFZofKI4PzhFOn1cl9Msc,1656
|
3
3
|
django_cfg/exceptions.py,sha256=RTQEoU3PfR8lqqNNv5ayd_HY2yJLs3eioqUy8VM6AG4,10378
|
4
4
|
django_cfg/integration.py,sha256=-7hvd-4ohLdzH4eufCZTOe3yTzPoQyB_HCfvsSm9AAw,5218
|
@@ -252,8 +252,8 @@ django_cfg/templates/emails/base_email.html,sha256=TWcvYa2IHShlF_E8jf1bWZStRO0v8
|
|
252
252
|
django_cfg/utils/__init__.py,sha256=64wwXJuXytvwt8Ze_erSR2HmV07nGWJ6DV5wloRBvYE,435
|
253
253
|
django_cfg/utils/path_resolution.py,sha256=eML-6-RIGTs5TePktIQN8nxfDUEFJ3JA0AzWBcihAbs,13894
|
254
254
|
django_cfg/utils/smart_defaults.py,sha256=iL6_n3jGDW5812whylWAwXik0xBSYihdLp4IJ26T5eA,20547
|
255
|
-
django_cfg-1.1.
|
256
|
-
django_cfg-1.1.
|
257
|
-
django_cfg-1.1.
|
258
|
-
django_cfg-1.1.
|
259
|
-
django_cfg-1.1.
|
255
|
+
django_cfg-1.1.63.dist-info/METADATA,sha256=cJwYgC8qkHiiP8nD8yAfE6ps9-SQyYQA9ItJCttPjmo,44084
|
256
|
+
django_cfg-1.1.63.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
257
|
+
django_cfg-1.1.63.dist-info/entry_points.txt,sha256=Ucmde4Z2wEzgb4AggxxZ0zaYDb9HpyE5blM3uJ0_VNg,56
|
258
|
+
django_cfg-1.1.63.dist-info/licenses/LICENSE,sha256=xHuytiUkSZCRG3N11nk1X6q1_EGQtv6aL5O9cqNRhKE,1071
|
259
|
+
django_cfg-1.1.63.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|