From 98e6e009f0347272f6b350448623f09f66f1963b Mon Sep 17 00:00:00 2001 From: AndyGrant Date: Fri, 25 Oct 2019 05:59:40 -0400 Subject: [PATCH] Use the htmlmin Django Middleware to reduce data usage Typical index html load reduced by 21% Typical viewtest html load reduced by 44% Typical search html load reduced by 12% Small style fixes to account for spaceless html --- OpenBench/static/style.css | 2 ++ OpenSite/settings.py | 9 ++++----- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/OpenBench/static/style.css b/OpenBench/static/style.css index dd95569..2fde157 100644 --- a/OpenBench/static/style.css +++ b/OpenBench/static/style.css @@ -37,6 +37,7 @@ a:link, a:visited, a:hover, a:active { #content label { width: 120px; + padding-right: 10px; font-weight:bold; text-align: right; display: inline-block; @@ -128,6 +129,7 @@ a:link, a:visited, a:hover, a:active { #content #actions .anchorbutton { color: #000000; padding: 8px 8px; + margin: 0px 8px; border-radius: 8px; font-weight: bold; text-align: center; diff --git a/OpenSite/settings.py b/OpenSite/settings.py index 9b47059..53189e1 100644 --- a/OpenSite/settings.py +++ b/OpenSite/settings.py @@ -15,18 +15,15 @@ import os # Build paths inside the project like this: os.path.join(BASE_DIR, ...) BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) - # Quick-start development settings - unsuitable for production # See https://docs.djangoproject.com/en/2.0/howto/deployment/checklist/ - # SECURITY WARNING: keep the secret key used in production secret! -SECRET_KEY = '@!zw2l8til1(0eb_nk+1w!(n78gqm&u)s)_v7#k6iseia@g9q0' - # SECURITY WARNING: don't run with debug turned on in production! +SECRET_KEY = '@!zw2l8til1(0eb_nk+1w!(n78gqm&u)s)_v7#k6iseia@g9q0' DEBUG = True ALLOWED_HOSTS = ['*'] - +HTML_MINIFY = True # Application definition @@ -54,6 +51,8 @@ MIDDLEWARE = [ 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware', + 'htmlmin.middleware.HtmlMinifyMiddleware', + 'htmlmin.middleware.MarkRequestMiddleware', ] ROOT_URLCONF = 'OpenSite.urls'