diff --git a/backend/shiftplan_backend/__pycache__/settings.cpython-314.pyc b/backend/shiftplan_backend/__pycache__/settings.cpython-314.pyc index 78ce6ab..c47fe4e 100644 Binary files a/backend/shiftplan_backend/__pycache__/settings.cpython-314.pyc and b/backend/shiftplan_backend/__pycache__/settings.cpython-314.pyc differ diff --git a/backend/shiftplan_backend/settings.py b/backend/shiftplan_backend/settings.py index c622bba..54695bd 100644 --- a/backend/shiftplan_backend/settings.py +++ b/backend/shiftplan_backend/settings.py @@ -126,7 +126,7 @@ TIME_ZONE = 'Europe/Berlin' USE_I18N = True USE_TZ = True -STATIC_URL = 'static/' +STATIC_URL = '/static/' STATIC_ROOT = BASE_DIR / 'staticfiles' STATICFILES_STORAGE = 'whitenoise.storage.CompressedManifestStaticFilesStorage' diff --git a/docker-compose.yml b/docker-compose.yml index d8c510e..79b5943 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -41,6 +41,8 @@ services: POSTGRES_PASSWORD: ${POSTGRES_PASSWORD:-shiftplan_secure_password_123} POSTGRES_HOST: db POSTGRES_PORT: "5432" + volumes: + - static_volume:/app/staticfiles depends_on: db: condition: service_healthy @@ -52,6 +54,8 @@ services: build: context: ./frontend dockerfile: Dockerfile + volumes: + - static_volume:/usr/share/nginx/html/static expose: - "80" depends_on: @@ -60,3 +64,4 @@ services: volumes: postgres_data: + static_volume: diff --git a/frontend/nginx.conf b/frontend/nginx.conf index 4a5edc8..9e489d1 100644 --- a/frontend/nginx.conf +++ b/frontend/nginx.conf @@ -49,6 +49,13 @@ server { } location /static/ { + alias /usr/share/nginx/html/static/; + expires 30d; + add_header Cache-Control "public, no-transform"; + try_files $uri @backend_static; + } + + location @backend_static { proxy_pass http://backend:8000/static/; proxy_set_header Host $http_host; proxy_set_header X-Real-IP $remote_addr;