2022-08-19 15:31:27 +01:00
|
|
|
from django.conf import settings
|
|
|
|
from django.http.request import HttpRequest
|
|
|
|
|
|
|
|
|
|
|
|
def global_vars(request: HttpRequest) -> dict:
|
2022-10-04 20:14:26 +01:00
|
|
|
# noop caching in preview
|
2022-10-04 21:27:53 +01:00
|
|
|
fragment_cache_ttl = 0 if getattr(request, "is_preview", False) else 21600
|
2022-10-04 20:14:26 +01:00
|
|
|
return {
|
|
|
|
"SEO_INDEX": settings.SEO_INDEX,
|
|
|
|
"DEBUG": settings.DEBUG,
|
|
|
|
"FRAGMENT_CACHE_TTL": fragment_cache_ttl,
|
|
|
|
"FRAGMENT_CACHE_TTL_JITTER": fragment_cache_ttl * 0.1,
|
|
|
|
}
|