Добавил whitenoise

This commit is contained in:
Viner Abubakirov
2026-01-03 01:41:55 +05:00
parent 75f0329edb
commit 6e2d6c250f
3 changed files with 16 additions and 0 deletions

View File

@@ -56,6 +56,7 @@ MIDDLEWARE = [
'django.middleware.clickjacking.XFrameOptionsMiddleware', 'django.middleware.clickjacking.XFrameOptionsMiddleware',
# Custom middlewares # Custom middlewares
"core.middleware.current_request.CurrentRequestMiddleware", "core.middleware.current_request.CurrentRequestMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
] ]
ROOT_URLCONF = 'music_storage.urls' ROOT_URLCONF = 'music_storage.urls'
@@ -132,6 +133,9 @@ STATIC_ROOT = BASE_DIR / 'staticfiles'
STATICFILES_DIRS = [ STATICFILES_DIRS = [
BASE_DIR / STATIC_URL BASE_DIR / STATIC_URL
] ]
STATICFILES_STORAGE = (
"whitenoise.storage.CompressedManifestStaticFilesStorage"
)
STORAGES = { STORAGES = {
# default storage for user uploads # default storage for user uploads

View File

@@ -12,4 +12,5 @@ dependencies = [
"pillow>=12.1.0", "pillow>=12.1.0",
"psycopg[binary]>=3.3.2", "psycopg[binary]>=3.3.2",
"python-dotenv>=1.2.1", "python-dotenv>=1.2.1",
"whitenoise>=6.11.0",
] ]

11
uv.lock generated
View File

@@ -98,6 +98,7 @@ dependencies = [
{ name = "pillow" }, { name = "pillow" },
{ name = "psycopg", extra = ["binary"] }, { name = "psycopg", extra = ["binary"] },
{ name = "python-dotenv" }, { name = "python-dotenv" },
{ name = "whitenoise" },
] ]
[package.metadata] [package.metadata]
@@ -109,6 +110,7 @@ requires-dist = [
{ name = "pillow", specifier = ">=12.1.0" }, { name = "pillow", specifier = ">=12.1.0" },
{ name = "psycopg", extras = ["binary"], specifier = ">=3.3.2" }, { name = "psycopg", extras = ["binary"], specifier = ">=3.3.2" },
{ name = "python-dotenv", specifier = ">=1.2.1" }, { name = "python-dotenv", specifier = ">=1.2.1" },
{ name = "whitenoise", specifier = ">=6.11.0" },
] ]
[[package]] [[package]]
@@ -292,3 +294,12 @@ sdist = { url = "https://files.pythonhosted.org/packages/5e/1d/0f3a93cca1ac5e828
wheels = [ wheels = [
{ url = "https://files.pythonhosted.org/packages/bc/56/190ceb8cb10511b730b564fb1e0293fa468363dbad26145c34928a60cb0c/urllib3-2.6.1-py3-none-any.whl", hash = "sha256:e67d06fe947c36a7ca39f4994b08d73922d40e6cca949907be05efa6fd75110b", size = 131138 }, { url = "https://files.pythonhosted.org/packages/bc/56/190ceb8cb10511b730b564fb1e0293fa468363dbad26145c34928a60cb0c/urllib3-2.6.1-py3-none-any.whl", hash = "sha256:e67d06fe947c36a7ca39f4994b08d73922d40e6cca949907be05efa6fd75110b", size = 131138 },
] ]
[[package]]
name = "whitenoise"
version = "6.11.0"
source = { registry = "https://pypi.org/simple" }
sdist = { url = "https://files.pythonhosted.org/packages/15/95/8c81ec6b6ebcbf8aca2de7603070ccf37dbb873b03f20708e0f7c1664bc6/whitenoise-6.11.0.tar.gz", hash = "sha256:0f5bfce6061ae6611cd9396a8231e088722e4fc67bc13a111be74c738d99375f", size = 26432 }
wheels = [
{ url = "https://files.pythonhosted.org/packages/6c/e9/4366332f9295fe0647d7d3251ce18f5615fbcb12d02c79a26f8dba9221b3/whitenoise-6.11.0-py3-none-any.whl", hash = "sha256:b2aeb45950597236f53b5342b3121c5de69c8da0109362aee506ce88e022d258", size = 20197 },
]