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:
pacnpal
2025-12-23 16:41:42 -05:00
parent ae31e889d7
commit edcd8f2076
155 changed files with 22046 additions and 4645 deletions

View File

@@ -6,9 +6,14 @@ from apps.parks.models import Park, Company
from apps.rides.models import Ride
from apps.core.analytics import PageView
from django.conf import settings
import logging
import os
import secrets
from apps.core.logging import log_exception
logger = logging.getLogger(__name__)
def handler404(request, exception):
return render(request, "404.html", status=404)
@@ -50,7 +55,13 @@ class HomeView(TemplateView):
trending_parks = Park.objects.exclude(
average_rating__isnull=True
).order_by("-average_rating")[:10]
except Exception:
except Exception as e:
log_exception(
logger,
e,
context={"operation": "get_trending_parks", "fallback": True},
request=self.request,
)
# Fallback to highest rated parks if trending calculation fails
trending_parks = Park.objects.exclude(
average_rating__isnull=True
@@ -70,7 +81,13 @@ class HomeView(TemplateView):
trending_rides = Ride.objects.exclude(
average_rating__isnull=True
).order_by("-average_rating")[:10]
except Exception:
except Exception as e:
log_exception(
logger,
e,
context={"operation": "get_trending_rides", "fallback": True},
request=self.request,
)
# Fallback to highest rated rides if trending calculation fails
trending_rides = Ride.objects.exclude(
average_rating__isnull=True
@@ -137,6 +154,22 @@ class SearchView(TemplateView):
Q(name__icontains=query) | Q(description__icontains=query)
).prefetch_related("operated_parks", "owned_parks")[:10]
logger.info(
f"Search query: '{query}' returned {len(context['parks'])} parks, "
f"{len(context['rides'])} rides, {len(context['companies'])} companies",
extra={
"query": query,
"parks_count": len(context["parks"]),
"rides_count": len(context["rides"]),
"companies_count": len(context["companies"]),
"user_id": (
self.request.user.id
if self.request.user.is_authenticated
else None
),
},
)
return context