Django static загружен, но не используется
Веб-сервер Nginx обслуживает статические файлы. Браузер загружает статические файлы, но они не работают. Почему это происходит?
docker-compose
volumes:
django_static:
services:
nginx:
build:
context: .
dockerfile: ./_nginx/Dockerfile
container_name: webserver
restart: unless-stopped
volumes:
- django_static:/app/staticfiles
ports:
- "80:80"
- "443:443"
depends_on:
- backend
backend:
build:
context: .
depends_on:
- postgres
command: /gunicorn.sh
entrypoint: /entrypoint.sh
restart: always
env_file: .env
volumes:
- django_static:/app/staticfiles
ports:
- "${CUSTOM_PORT}:8000"
staticfiles config
STATIC_URL = '/static/'
MEDIA_URL = '/media/'
STATIC_ROOT = os.path.join(BASE_DIR, 'staticfiles')
MEDIA_ROOT = os.path.join(BASE_DIR, 'media')
STATICFILES_DIRS = [
os.path.join(BASE_DIR, "static")
]