import os import time from .models import AppSetting def project_context(request): """ Adds project-specific environment variables and settings to the template context globally. """ settings = AppSetting.objects.first() if not settings: # Create default settings if none exist settings = AppSetting.objects.create(app_name="DN-WRS") return { "project_name": settings.app_name, "project_description": settings.app_description or os.getenv("PROJECT_DESCRIPTION", ""), "project_address": settings.app_address, "project_phone": settings.app_phone, "project_email": settings.app_email, "project_image_url": os.getenv("PROJECT_IMAGE_URL", ""), # Used for cache-busting static assets "deployment_timestamp": int(time.time()), }