Feature: Add ahead of time compression of the static files for x86_64 (#4390)

Compressed staticfiles. x86_64 only at this point
This commit is contained in:
Trenton H
2023-10-20 16:22:05 -07:00
committed by GitHub
parent 9880f9ebc7
commit d480e91196
3 changed files with 25 additions and 3 deletions

View File

@@ -7,6 +7,7 @@ import re
import tempfile
from os import PathLike
from pathlib import Path
from platform import machine
from typing import Final
from typing import Optional
from typing import Union
@@ -342,6 +343,17 @@ ASGI_APPLICATION = "paperless.asgi.application"
STATIC_URL = os.getenv("PAPERLESS_STATIC_URL", BASE_URL + "static/")
WHITENOISE_STATIC_PREFIX = "/static/"
if machine().lower() == "aarch64": # pragma: no cover
_static_backend = "django.contrib.staticfiles.storage.StaticFilesStorage"
else:
_static_backend = "whitenoise.storage.CompressedStaticFilesStorage"
STORAGES = {
"staticfiles": {
"BACKEND": _static_backend,
},
}
_CELERY_REDIS_URL, _CHANNELS_REDIS_URL = _parse_redis_url(
os.getenv("PAPERLESS_REDIS", None),
)