From 95b868c7e8fe6d1b6aa11155de5cff9e2e04b2a9 Mon Sep 17 00:00:00 2001 From: westfarn Date: Sun, 6 Jul 2025 17:53:51 +0000 Subject: [PATCH] Update dta_service/dta_service/asgi.py --- dta_service/dta_service/asgi.py | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/dta_service/dta_service/asgi.py b/dta_service/dta_service/asgi.py index 0cc66af..1fa107a 100644 --- a/dta_service/dta_service/asgi.py +++ b/dta_service/dta_service/asgi.py @@ -6,11 +6,19 @@ It exposes the ASGI callable as a module-level variable named ``application``. For more information on this file, see https://docs.djangoproject.com/en/5.2/howto/deployment/asgi/ """ - import os - from django.core.asgi import get_asgi_application +from channels.routing import ProtocolTypeRouter, URLRouter +from channels.auth import AuthMiddlewareStack +import core.routing -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dta_service.settings') +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings') -application = get_asgi_application() +application = ProtocolTypeRouter({ + "http": get_asgi_application(), + "websocket": AuthMiddlewareStack( + URLRouter( + core.routing.websocket_urlpatterns + ) + ), + })