Add caching

This commit is contained in:
Mark Veidemanis 2023-02-11 14:03:50 +00:00
parent 87c232d3f9
commit 40a710f41e
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
3 changed files with 317 additions and 296 deletions

View File

@ -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"

View File

@ -1,8 +1,10 @@
{% load static %}
{% load has_plan %}
{% load cache %}
<!DOCTYPE html>
<html lang="en-GB">
{% cache 600 head %}
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
@ -235,8 +237,9 @@
<!-- End Piwik Code -->
</head>
{% endcache %}
<body>
{% cache 600 nav request.user.id %}
<nav class="navbar" role="navigation" aria-label="main navigation">
<div class="navbar-brand">
<a class="navbar-item" href="{% url 'home' %}">
@ -334,6 +337,7 @@
</div>
</div>
</nav>
{% endcache %}
<script>
let deferredPrompt;
const addBtn = document.querySelector('.add-button');

View File

@ -22,3 +22,6 @@ msgpack
apscheduler
django-prettyjson
git+https://git.zm.is/XF/django-crud-mixins
# For caching
redis
hiredis