From a62522d36a0360f052a6adb3f04bc0c1ac5d80ee Mon Sep 17 00:00:00 2001 From: Danielle McLean Date: Mon, 28 May 2018 17:52:24 +1000 Subject: [PATCH] Make some performance tweaks - persistent database connections, static file hashing, conditional GET support (ETags and stuff) --- lemoncurry/settings/base.py | 5 ++++- lemoncurry/settings/test.py | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/lemoncurry/settings/base.py b/lemoncurry/settings/base.py index a912d3e..8068b11 100644 --- a/lemoncurry/settings/base.py +++ b/lemoncurry/settings/base.py @@ -104,6 +104,7 @@ INSTALLED_APPS = [ MIDDLEWARE = [ 'debug_toolbar.middleware.DebugToolbarMiddleware', + 'django.middleware.http.ConditionalGetMiddleware', 'django.middleware.security.SecurityMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', @@ -162,7 +163,8 @@ CACHES = { DATABASES = { 'default': { 'ENGINE': 'django.db.backends.postgresql', - 'NAME': 'lemoncurry' + 'NAME': 'lemoncurry', + 'CONN_MAX_AGE': 3600 } } @@ -219,6 +221,7 @@ STATICFILES_FINDERS = ( 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'compressor.finders.CompressorFinder', ) +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage' COMPRESS_PRECOMPILERS = ( ('text/stylus', 'npx stylus -u ./lemoncurry/static/lemoncurry/css/theme'), diff --git a/lemoncurry/settings/test.py b/lemoncurry/settings/test.py index 2e94a81..a9489fc 100644 --- a/lemoncurry/settings/test.py +++ b/lemoncurry/settings/test.py @@ -2,3 +2,4 @@ from .base import * ALLOWED_HOSTS = ['*'] SECURE_SSL_REDIRECT = False +STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'