From 9a3fabf36694cf61abb37514a9495b140ff3d7ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=89=91=E5=AD=90=E4=BB=99=E6=9C=BA?= Date: Mon, 17 Jan 2022 17:21:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dasgi=E5=9C=A8daphne=E9=83=A8?= =?UTF-8?q?=E7=BD=B2=E6=97=B6=E6=8A=A5=E9=94=99=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sysom_api/sysom/asgi.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/sysom_api/sysom/asgi.py b/sysom_api/sysom/asgi.py index 76fd715c..751c321f 100644 --- a/sysom_api/sysom/asgi.py +++ b/sysom_api/sysom/asgi.py @@ -8,14 +8,15 @@ https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/ """ import os +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sysom.settings') +import django +django.setup() from django.urls import path from channels.routing import ProtocolTypeRouter, URLRouter from django.core.asgi import get_asgi_application from consumer.consumers import SshConsumer from consumer.middleware import AuthMiddleware -os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'sysom.settings') - application = ProtocolTypeRouter({ "http": get_asgi_application(), "websocket": AuthMiddleware( -- Gitee