1、dwebsocket
2、等框架都是错误的
3、 django/channels 才是正确姿势 555
4、
pip install -U channels
完成后,您应该添加channels
到您的 INSTALLED_APPS
设置:
INSTALLED_APPS = ( ???‘django.contrib.auth‘, ???‘django.contrib.contenttypes‘, ???‘django.contrib.sessions‘, ???‘django.contrib.sites‘, ???... ???‘channels‘,)
然后,在以下位置进行默认路由myproject/routing.py
:
from channels.routing import ProtocolTypeRouterapplication = ProtocolTypeRouter({ ???# Empty for now (http->django views is added by default)})
最后,将您的ASGI_APPLICATION
设置设置为指向该路由对象作为根应用程序:
ASGI_APPLICATION = "myproject.routing.application"
django websocket
原文地址:https://www.cnblogs.com/Mvloveyouforever/p/10499015.html