- Standardized string formatting in cursor rules for consistency. - Added a new rollback deployment script to facilitate blue-green deployment strategy. - Removed outdated seed data files and introduced new rarity mappings for better data management. - Improved model relationships and query optimizations in various views and admin configurations. - Enhanced caching strategies across templates to improve performance and reduce load times, including jitter in cache settings for better performance. - Refactored card-related views and templates to utilize new model fields and relationships.
28 lines
782 B
Python
28 lines
782 B
Python
import random
|
|
|
|
from django.conf import settings
|
|
|
|
|
|
def cache_settings(request):
|
|
"""
|
|
Pass cache settings to the template context.
|
|
Applies jitter to the timeouts.
|
|
"""
|
|
jitter = settings.CACHE_JITTER
|
|
return {
|
|
"CACHE_SHORT_TIMEOUT": settings.CACHE_SHORT_TIMEOUT
|
|
+ random.randint(-jitter, jitter),
|
|
"CACHE_MEDIUM_TIMEOUT": settings.CACHE_MEDIUM_TIMEOUT
|
|
+ random.randint(-jitter, jitter),
|
|
"CACHE_LONG_TIMEOUT": settings.CACHE_LONG_TIMEOUT
|
|
+ random.randint(-jitter, jitter),
|
|
"CACHE_DEFAULT_TIMEOUT": settings.CACHE_DEFAULT_TIMEOUT
|
|
+ random.randint(-jitter, jitter),
|
|
}
|
|
|
|
|
|
def version_info(request):
|
|
return {
|
|
"VERSION": settings.VERSION,
|
|
"VERSION_INFO": settings.VERSION_INFO,
|
|
}
|