code
This commit is contained in:
+15
-1
@@ -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
|
||||
)
|
||||
),
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user