From c3b0822cf7d34fc395d4425522961337a91930c3 Mon Sep 17 00:00:00 2001 From: Ross Date: Wed, 1 Sep 2021 19:26:53 +0100 Subject: [PATCH] . --- rad/settings.py | 4 ++++ rapids/urls.py | 5 ++++- requirements.txt | 3 ++- 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/rad/settings.py b/rad/settings.py index 1c1edb47..db447594 100644 --- a/rad/settings.py +++ b/rad/settings.py @@ -196,6 +196,10 @@ CORS_ORIGIN_ALLOW_ALL = True CACHES = { 'default': { + 'BACKEND': 'django.core.cache.backends.memcached.PyMemcacheCache', + 'LOCATION': '127.0.0.1:11211', + }, + 'filesystem': { 'BACKEND': 'django.core.cache.backends.filebased.FileBasedCache', 'LOCATION': '/var/tmp/django_cache', } diff --git a/rapids/urls.py b/rapids/urls.py index ffb283e7..1e24f6c6 100755 --- a/rapids/urls.py +++ b/rapids/urls.py @@ -1,6 +1,9 @@ from django.urls import path, include from . import views +from django.views.decorators.cache import cache_page + + app_name = "rapids" urlpatterns = [ @@ -51,7 +54,7 @@ urlpatterns = [ views.RapidExamViews.exam_json_edit, name="exam_json_edit", ), - path("exam//scores", views.exam_scores_cid, name="exam_scores_cid"), + path("exam//scores", cache_page(60 * 1)(views.exam_scores_cid), name="exam_scores_cid"), path( "exam//scores//", views.exam_scores_cid_user, diff --git a/requirements.txt b/requirements.txt index 857e0394..ce84e364 100644 --- a/requirements.txt +++ b/requirements.txt @@ -19,4 +19,5 @@ django-dbbackup django-hashedfilenamestorage djangorestframework django-tinymce -django-zipview \ No newline at end of file +django-zipview +pymemcache \ No newline at end of file