Make some performance tweaks - persistent database connections, static file hashing, conditional GET support (ETags and stuff)

This commit is contained in:
Danielle McLean 2018-05-28 17:52:24 +10:00
parent 15e5219e3a
commit a62522d36a
Signed by: 00dani
GPG key ID: 8EB789DDF3ABD240
2 changed files with 5 additions and 1 deletions

View file

@ -104,6 +104,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [ MIDDLEWARE = [
'debug_toolbar.middleware.DebugToolbarMiddleware', 'debug_toolbar.middleware.DebugToolbarMiddleware',
'django.middleware.http.ConditionalGetMiddleware',
'django.middleware.security.SecurityMiddleware', 'django.middleware.security.SecurityMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware', 'django.contrib.admindocs.middleware.XViewMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware',
@ -162,7 +163,8 @@ CACHES = {
DATABASES = { DATABASES = {
'default': { 'default': {
'ENGINE': 'django.db.backends.postgresql', 'ENGINE': 'django.db.backends.postgresql',
'NAME': 'lemoncurry' 'NAME': 'lemoncurry',
'CONN_MAX_AGE': 3600
} }
} }
@ -219,6 +221,7 @@ STATICFILES_FINDERS = (
'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder',
'compressor.finders.CompressorFinder', 'compressor.finders.CompressorFinder',
) )
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.ManifestStaticFilesStorage'
COMPRESS_PRECOMPILERS = ( COMPRESS_PRECOMPILERS = (
('text/stylus', 'npx stylus -u ./lemoncurry/static/lemoncurry/css/theme'), ('text/stylus', 'npx stylus -u ./lemoncurry/static/lemoncurry/css/theme'),

View file

@ -2,3 +2,4 @@ from .base import *
ALLOWED_HOSTS = ['*'] ALLOWED_HOSTS = ['*']
SECURE_SSL_REDIRECT = False SECURE_SSL_REDIRECT = False
STATICFILES_STORAGE = 'django.contrib.staticfiles.storage.StaticFilesStorage'