Skip to content

Commit

Permalink
Experiment with Whitenoise static file compression
Browse files Browse the repository at this point in the history
  • Loading branch information
stumpylog committed Dec 16, 2022
1 parent feec369 commit b1cac94
Show file tree
Hide file tree
Showing 5 changed files with 94 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Pipfile
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ rapidfuzz = "*"
redis = {extras = ["hiredis"], version = "*"}
scikit-learn = "~=1.1"
numpy = "*"
whitenoise = "~=6.2"
whitenoise = {version = "~=6.2", extras = ["brotli"]}
watchdog = "~=2.1"
whoosh="~=2.7"
inotifyrecursive = "~=0.3"
Expand Down
89 changes: 88 additions & 1 deletion Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions src/documents/static/bootstrap.min.css.map

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions src/documents/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ def setUpClass(cls):

cls.override = override_settings(
STATIC_ROOT=cls.static_dir,
STATICFILES_STORAGE=None,
)
cls.override.enable()

Expand Down
3 changes: 3 additions & 0 deletions src/paperless/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,9 @@ def _parse_redis_url(env_redis: Optional[str]) -> Tuple[str]:
"django.middleware.clickjacking.XFrameOptionsMiddleware",
]

# Enable whitenoise compression and caching
STATICFILES_STORAGE = "whitenoise.storage.CompressedStaticFilesStorage"

ROOT_URLCONF = "paperless.urls"

FORCE_SCRIPT_NAME = os.getenv("PAPERLESS_FORCE_SCRIPT_NAME")
Expand Down

0 comments on commit b1cac94

Please sign in to comment.