I just configured channels on my project but when I enter the admin page or other pages, I see this error:
Refused to apply style from 'http://127.0.0.1:8000/static/admin/css/base.css' because its MIME type ('text/html') is not a supported stylesheet MIME type, and strict MIME checking is enabled.
GET http://127.0.0.1:8000/static/admin/js/theme.js net::ERR_ABORTED 404 (Not Found)
Before configuring channels everything was loading correctly.
docker-compose:
services:
backend:
build: .
container_name: backend
command: daphne -b 0.0.0.0 -p 8000 core.asgi:application
restart: always
volumes:
- ./core:/app
ports:
- "8000:8000"
env_file:
- ./.env.dev
depends_on:
- db
asgi.py:
import os
from channels.routing import ProtocolTypeRouter
from django.core.asgi import get_asgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "core.settings")
django_asgi_app = get_asgi_application()
application = ProtocolTypeRouter({
"http": django_asgi_app,
})
settings.py:
DEBUG = True
ASGI_APPLICATION = "core.asgi.application"
CHANNEL_LAYERS = {
"default": {
"BACKEND": "channels.layers.InMemoryChannelLayer",
}
}