Serve Django admin static assets

This commit is contained in:
Andrey committed 2026-06-17 18:41:41 +03:00
1 parent cce08385ff
commit 0abc421766
4 files changed
+14 -1

No files matched your search

+1
View File
@@ -2,6 +2,7 @@
.venv/
__pycache__/
*.py[cod]
apps/backend/staticfiles/
.pytest_cache/
.ruff_cache/
.mypy_cache/
+10
View File
@@ -38,6 +38,7 @@ INSTALLED_APPS = [
MIDDLEWARE = [
"django.middleware.security.SecurityMiddleware",
"whitenoise.middleware.WhiteNoiseMiddleware",
"hub_platform.http.middleware.LocalCorsMiddleware",
"django.contrib.sessions.middleware.SessionMiddleware",
"django.middleware.common.CommonMiddleware",
@@ -102,6 +103,15 @@ USE_I18N = True
USE_TZ = True
STATIC_URL = "static/"
STATIC_ROOT = BASE_DIR / "staticfiles"
STORAGES = {
"default": {
"BACKEND": "django.core.files.storage.FileSystemStorage",
},
"staticfiles": {
"BACKEND": "whitenoise.storage.CompressedManifestStaticFilesStorage",
},
}
DEFAULT_AUTO_FIELD = "django.db.models.BigAutoField"
REST_FRAMEWORK = {
+1
View File
@@ -4,6 +4,7 @@ psycopg[binary]>=3.2,<3.3
redis>=5.2,<5.3
uvicorn[standard]>=0.34,<0.35
gunicorn>=23.0,<24.0
whitenoise>=6.9,<6.10
pytest>=8.4,<8.5
pytest-django>=4.11,<4.12
ruff>=0.12,<0.13
+2 -1
View File
@@ -36,7 +36,8 @@ services:
dockerfile: apps/backend/Dockerfile
env_file: *hub-env
command: >
sh -c "python manage.py migrate &&
sh -c "python manage.py collectstatic --noinput &&
python manage.py migrate &&
uvicorn hub_backend.asgi:application --host 0.0.0.0 --port 8000"
ports:
- "${BACKEND_PORT:-8010}:8000"