Skip to content

Commit

Permalink
Activate whitenoise and static file compression and caching
Browse files Browse the repository at this point in the history
  • Loading branch information
diveflo committed Jul 24, 2019
1 parent 3975479 commit 528b4ac
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/paperless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ def __get_boolean(key, default="NO"):
# Application definition

INSTALLED_APPS = [
"whitenoise.runserver_nostatic",

"django.contrib.auth",
"django.contrib.contenttypes",
Expand Down Expand Up @@ -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',
Expand All @@ -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(","))

Expand Down

0 comments on commit 528b4ac

Please sign in to comment.