From 40a710f41e0a5e6579296e1ab275c2b0bffd1bd8 Mon Sep 17 00:00:00 2001 From: Mark Veidemanis Date: Sat, 11 Feb 2023 14:03:50 +0000 Subject: [PATCH] Add caching --- app/settings.py | 14 + core/templates/base.html | 618 ++++++++++++++++++++------------------- requirements.txt | 3 + 3 files changed, 328 insertions(+), 307 deletions(-) diff --git a/app/settings.py b/app/settings.py index b78c03f..d8dd5db 100644 --- a/app/settings.py +++ b/app/settings.py @@ -45,6 +45,20 @@ INSTALLED_APPS = [ "prettyjson", "mixins", ] + +# Performance optimisations +CACHES = { + "default": { + "BACKEND": "django.core.cache.backends.redis.RedisCache", + "LOCATION": "unix:///var/run/socks/redis.sock", + "OPTIONS": { + "db": "10", + "parser_class": "redis.connection.PythonParser", + "pool_class": "redis.BlockingConnectionPool", + }, + } +} + CRISPY_TEMPLATE_PACK = "bulma" CRISPY_ALLOWED_TEMPLATE_PACKS = ("bulma",) DJANGO_TABLES2_TEMPLATE = "django-tables2/bulma.html" diff --git a/core/templates/base.html b/core/templates/base.html index 83e6282..f95a5d1 100644 --- a/core/templates/base.html +++ b/core/templates/base.html @@ -1,339 +1,343 @@ {% load static %} {% load has_plan %} +{% load cache %} - - - - Pathogen - {{ request.path_info }} - - - - - - - - - - - - - - - - - - - - + + + + + + + + + - + - - {# Yes it's in the source, fight me #} - - - + }); + + + {# Yes it's in the source, fight me #} + + + + + {% endcache %} - - + {% endcache %}