This commit is contained in:
aqu415
2022-02-12 18:53:37 +08:00
parent 94d436fa3b
commit dbb53469a9
24 changed files with 5185 additions and 12 deletions
+15 -1
View File
@@ -9,8 +9,22 @@ https://docs.djangoproject.com/en/3.2/howto/deployment/asgi/
import os
from channels.auth import AuthMiddlewareStack
from channels.routing import ProtocolTypeRouter, URLRouter
from django.core.asgi import get_asgi_application
from server.websocket.routing import websocket_urlpatterns
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jsmindmulti.settings')
application = get_asgi_application()
application = ProtocolTypeRouter({
# http 请求
"http": get_asgi_application(),
# websocket 请求
# channels文档:https://channels.readthedocs.io/en/stable/tutorial/index.html
"websocket": AuthMiddlewareStack(
URLRouter(
websocket_urlpatterns
)
),
})