From dd39b830f9b1f4b1d69dfc2b3917b68a0e6f9675 Mon Sep 17 00:00:00 2001 From: RogerWork Date: Mon, 19 Feb 2024 11:28:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E8=AF=95=20uvicorn?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dingxin_toolbox_drf/asgi.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/dingxin_toolbox_drf/asgi.py b/dingxin_toolbox_drf/asgi.py index 655d536..1f15cf2 100644 --- a/dingxin_toolbox_drf/asgi.py +++ b/dingxin_toolbox_drf/asgi.py @@ -8,18 +8,20 @@ https://docs.djangoproject.com/en/4.2/howto/deployment/asgi/ """ import os - +import django from django.core.asgi import get_asgi_application from channels.routing import ProtocolTypeRouter, URLRouter +from channels.routing import get_default_application from .urls import websocket_urlpatterns os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'dingxin_toolbox_drf.settings') # os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') - +django.setup() # application = get_asgi_application() application = ProtocolTypeRouter( { - 'http': get_asgi_application(), + # 'http': get_asgi_application(), + 'http': get_default_application(), 'websocket': URLRouter(websocket_urlpatterns) }