Create config/environments/development.py
Browse files
config/environments/development.py
ADDED
|
@@ -0,0 +1,136 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
"""
|
| 2 |
+
Development environment configuration for BackgroundFX Pro.
|
| 3 |
+
|
| 4 |
+
Optimized for local development with debugging and hot-reload enabled.
|
| 5 |
+
"""
|
| 6 |
+
|
| 7 |
+
from dataclasses import dataclass, field
|
| 8 |
+
from pathlib import Path
|
| 9 |
+
from typing import List
|
| 10 |
+
|
| 11 |
+
from ..settings import Settings
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
@dataclass
|
| 15 |
+
class DevelopmentSettings(Settings):
|
| 16 |
+
"""
|
| 17 |
+
Development-specific configuration with relaxed security and debug features.
|
| 18 |
+
"""
|
| 19 |
+
|
| 20 |
+
# Environment
|
| 21 |
+
environment: str = "development"
|
| 22 |
+
debug: bool = True
|
| 23 |
+
|
| 24 |
+
# Server settings
|
| 25 |
+
host: str = "127.0.0.1"
|
| 26 |
+
port: int = 8000
|
| 27 |
+
workers: int = 1
|
| 28 |
+
reload: bool = True # Hot reload enabled
|
| 29 |
+
|
| 30 |
+
# Security - Relaxed for development
|
| 31 |
+
secret_key: str = "dev-secret-key-not-for-production"
|
| 32 |
+
cors_origins: List[str] = field(default_factory=lambda: ["*"]) # Allow all origins
|
| 33 |
+
|
| 34 |
+
# API settings
|
| 35 |
+
api_docs_enabled: bool = True # Enable Swagger UI
|
| 36 |
+
|
| 37 |
+
# Database - Local PostgreSQL
|
| 38 |
+
database_url: str = "postgresql://postgres:postgres@localhost:5432/backgroundfx_dev"
|
| 39 |
+
database_echo: bool = True # Log SQL queries
|
| 40 |
+
database_pool_size: int = 5
|
| 41 |
+
database_max_overflow: int = 10
|
| 42 |
+
|
| 43 |
+
# MongoDB - Local instance
|
| 44 |
+
mongodb_url: str = "mongodb://localhost:27017/backgroundfx_dev"
|
| 45 |
+
|
| 46 |
+
# Redis - Local instance
|
| 47 |
+
redis_url: str = "redis://localhost:6379/0"
|
| 48 |
+
redis_max_connections: int = 10
|
| 49 |
+
|
| 50 |
+
# Storage - Local filesystem for development
|
| 51 |
+
storage_backend: str = "local"
|
| 52 |
+
local_storage_path: Path = field(default_factory=lambda: Path("./storage/dev"))
|
| 53 |
+
|
| 54 |
+
# Processing - Smaller limits for development
|
| 55 |
+
max_image_size: int = 20 * 1024 * 1024 # 20MB
|
| 56 |
+
max_video_size: int = 100 * 1024 * 1024 # 100MB
|
| 57 |
+
max_batch_size: int = 10
|
| 58 |
+
processing_timeout: int = 120 # 2 minutes
|
| 59 |
+
enable_gpu: bool = False # Usually no GPU in dev
|
| 60 |
+
gpu_memory_fraction: float = 0.5
|
| 61 |
+
|
| 62 |
+
# Models - Local directory
|
| 63 |
+
models_dir: Path = field(default_factory=lambda: Path("./models"))
|
| 64 |
+
model_cache_dir: Path = field(default_factory=lambda: Path("./cache/models"))
|
| 65 |
+
|
| 66 |
+
# Queue - Local Redis
|
| 67 |
+
celery_broker_url: str = "redis://localhost:6379/1"
|
| 68 |
+
celery_result_backend: str = "redis://localhost:6379/2"
|
| 69 |
+
celery_worker_concurrency: int = 2
|
| 70 |
+
celery_task_time_limit: int = 300 # 5 minutes
|
| 71 |
+
|
| 72 |
+
# JWT - Simple key for development
|
| 73 |
+
jwt_secret_key: str = "dev-jwt-secret-key"
|
| 74 |
+
jwt_expiration_delta: int = 86400 # 1 day
|
| 75 |
+
|
| 76 |
+
# Rate limiting - Relaxed for development
|
| 77 |
+
rate_limit_enabled: bool = False
|
| 78 |
+
rate_limit_requests: int = 10000
|
| 79 |
+
rate_limit_window: int = 60
|
| 80 |
+
|
| 81 |
+
# Monitoring - Disabled in development
|
| 82 |
+
sentry_dsn: str = "" # Disabled
|
| 83 |
+
prometheus_enabled: bool = False
|
| 84 |
+
|
| 85 |
+
# Logging - Verbose logging
|
| 86 |
+
log_level: str = "DEBUG"
|
| 87 |
+
log_file: str = "./logs/dev.log"
|
| 88 |
+
|
| 89 |
+
# Cache - Shorter TTL for development
|
| 90 |
+
cache_ttl: int = 60 # 1 minute
|
| 91 |
+
cache_max_entries: int = 100
|
| 92 |
+
|
| 93 |
+
# CDN - Disabled in development
|
| 94 |
+
cdn_enabled: bool = False
|
| 95 |
+
cdn_base_url: str = "http://localhost:8000/static"
|
| 96 |
+
|
| 97 |
+
# Email - Console backend for development
|
| 98 |
+
smtp_host: str = "localhost"
|
| 99 |
+
smtp_port: int = 1025 # MailHog or similar
|
| 100 |
+
smtp_use_tls: bool = False
|
| 101 |
+
email_from: str = "dev@localhost"
|
| 102 |
+
|
| 103 |
+
# Webhooks - Shorter timeouts for development
|
| 104 |
+
webhook_timeout: int = 10
|
| 105 |
+
webhook_max_retries: int = 1
|
| 106 |
+
webhook_retry_delay: int = 1
|
| 107 |
+
|
| 108 |
+
# Feature flags - Everything enabled for testing
|
| 109 |
+
enable_video_processing: bool = True
|
| 110 |
+
enable_batch_processing: bool = True
|
| 111 |
+
enable_ai_backgrounds: bool = True
|
| 112 |
+
enable_webhooks: bool = True
|
| 113 |
+
|
| 114 |
+
# Development-specific settings
|
| 115 |
+
auto_create_test_data: bool = True
|
| 116 |
+
mock_external_services: bool = True
|
| 117 |
+
enable_profiling: bool = True
|
| 118 |
+
enable_debug_toolbar: bool = True
|
| 119 |
+
|
| 120 |
+
def __post_init__(self):
|
| 121 |
+
"""Additional development-specific initialization."""
|
| 122 |
+
super().__post_init__()
|
| 123 |
+
|
| 124 |
+
# Create development directories
|
| 125 |
+
for dir_path in [
|
| 126 |
+
self.local_storage_path,
|
| 127 |
+
self.models_dir,
|
| 128 |
+
self.model_cache_dir,
|
| 129 |
+
self.log_dir,
|
| 130 |
+
self.temp_dir
|
| 131 |
+
]:
|
| 132 |
+
dir_path.mkdir(parents=True, exist_ok=True)
|
| 133 |
+
|
| 134 |
+
# Create test data directory
|
| 135 |
+
test_data_dir = Path("./test_data")
|
| 136 |
+
test_data_dir.mkdir(exist_ok=True)
|