import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "mi_web.settings") import django django.setup() from channels.auth import AuthMiddlewareStack from channels.routing import ProtocolTypeRouter, URLRouter from django.core.asgi import get_asgi_application from apps.chat.routing import websocket_urlpatterns application = ProtocolTypeRouter( { "websocket": AuthMiddlewareStack(URLRouter(websocket_urlpatterns)), } )