24 lines
724 B
Python
24 lines
724 B
Python
from .models import SystemSetting
|
|
import os
|
|
from django.utils import timezone
|
|
|
|
def project_context(request):
|
|
"""
|
|
Injects project description and social image URL from environment variables.
|
|
Also injects a deployment timestamp for cache-busting.
|
|
"""
|
|
return {
|
|
"project_description": os.getenv("PROJECT_DESCRIPTION", ""),
|
|
"project_image_url": os.getenv("PROJECT_IMAGE_URL", ""),
|
|
"deployment_timestamp": int(timezone.now().timestamp()),
|
|
}
|
|
|
|
def global_settings(request):
|
|
try:
|
|
settings = SystemSetting.objects.first()
|
|
if not settings:
|
|
settings = SystemSetting.objects.create()
|
|
return {'site_settings': settings}
|
|
except:
|
|
return {}
|