From 528b4ac2f0ab8a9973eafecd233d74edbc4bb381 Mon Sep 17 00:00:00 2001 From: Florian Gabsteiger Date: Wed, 24 Jul 2019 13:26:28 -0900 Subject: [PATCH] Activate whitenoise and static file compression and caching --- src/paperless/settings.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/paperless/settings.py b/src/paperless/settings.py index 917d1e64f..ce387be07 100644 --- a/src/paperless/settings.py +++ b/src/paperless/settings.py @@ -62,6 +62,7 @@ def __get_boolean(key, default="NO"): # Application definition INSTALLED_APPS = [ + "whitenoise.runserver_nostatic", "django.contrib.auth", "django.contrib.contenttypes", @@ -92,6 +93,7 @@ def __get_boolean(key, default="NO"): MIDDLEWARE = [ 'django.middleware.security.SecurityMiddleware', + 'whitenoise.middleware.WhiteNoiseMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'corsheaders.middleware.CorsMiddleware', 'django.middleware.common.CommonMiddleware', @@ -101,6 +103,9 @@ def __get_boolean(key, default="NO"): 'django.middleware.clickjacking.XFrameOptionsMiddleware', ] +# Enable whitenoise compression and caching +STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' + # We allow CORS from localhost:8080 CORS_ORIGIN_WHITELIST = tuple(os.getenv("PAPERLESS_CORS_ALLOWED_HOSTS", "localhost:8080").split(","))