mirror of
https://github.com/pacnpal/thrillwiki_django_no_react.git
synced 2025-12-24 23:11:08 -05:00
Add secret management guide, client-side performance monitoring, and search accessibility enhancements
- Introduced a comprehensive Secret Management Guide detailing best practices, secret classification, development setup, production management, rotation procedures, and emergency protocols. - Implemented a client-side performance monitoring script to track various metrics including page load performance, paint metrics, layout shifts, and memory usage. - Enhanced search accessibility with keyboard navigation support for search results, ensuring compliance with WCAG standards and improving user experience.
This commit is contained in:
@@ -3,7 +3,6 @@
|
||||
|
||||
import os
|
||||
import sys
|
||||
from decouple import config
|
||||
|
||||
|
||||
def main():
|
||||
@@ -32,7 +31,20 @@ def main():
|
||||
|
||||
|
||||
def detect_settings_module():
|
||||
"""Auto-detect the appropriate settings module based on context."""
|
||||
"""
|
||||
Auto-detect the appropriate settings module based on context.
|
||||
|
||||
Detection order:
|
||||
1. DJANGO_SETTINGS_MODULE environment variable (explicit override)
|
||||
2. Test command detection (uses test settings)
|
||||
3. Production indicators (environment variables from cloud providers)
|
||||
4. Staging indicators (staging-specific environment variables)
|
||||
5. DEBUG environment variable (False = production)
|
||||
6. Default to local development
|
||||
|
||||
Returns:
|
||||
str: The settings module path (e.g., "config.django.local")
|
||||
"""
|
||||
# Check if DJANGO_SETTINGS_MODULE is already set
|
||||
if "DJANGO_SETTINGS_MODULE" in os.environ:
|
||||
return os.environ["DJANGO_SETTINGS_MODULE"]
|
||||
@@ -43,20 +55,29 @@ def detect_settings_module():
|
||||
return "config.django.test_accounts"
|
||||
return "config.django.test"
|
||||
|
||||
# Check for production indicators
|
||||
# Production indicators from various cloud providers
|
||||
production_indicators = [
|
||||
"DYNO", # Heroku
|
||||
"AWS_EXECUTION_ENV", # AWS Lambda
|
||||
"AWS_ECS_CLUSTER", # AWS ECS
|
||||
"KUBERNETES_SERVICE_HOST", # Kubernetes
|
||||
"DOCKER_CONTAINER", # Docker
|
||||
"FLY_APP_NAME", # Fly.io
|
||||
"RAILWAY_ENVIRONMENT", # Railway
|
||||
"RENDER", # Render
|
||||
"VERCEL", # Vercel
|
||||
]
|
||||
|
||||
if any(indicator in os.environ for indicator in production_indicators):
|
||||
return "config.django.production"
|
||||
|
||||
# Staging detection (explicit staging environment variable)
|
||||
if os.environ.get("ENVIRONMENT", "").lower() in ("staging", "stage"):
|
||||
return "config.django.production" # Use production settings for staging
|
||||
|
||||
# Check DEBUG environment variable
|
||||
debug = os.environ.get("DEBUG", "").lower()
|
||||
if debug in ("false", "0", "no"):
|
||||
if debug in ("false", "0", "no", "off"):
|
||||
return "config.django.production"
|
||||
|
||||
# Default to local development
|
||||
|
||||
Reference in New Issue
Block a user