我正在使用django-channels进行聊天应用,但我有奇怪的路由错误。
AttributeError: 'Message' object has no attribute 'META'
所以这是我的routing.py
from channels.routing import route, include
from chat.consumers import ws_connect, ws_message, ws_disconnect
from chat.views import chatmain
http_routing = [
route("http.request", chatmain, path=r"^/chatwindow/$", method=r"^GET$"),
]
chat_routing = [
route("websocket.connect", ws_connect),
route("websocket.receive", ws_message),
route("websocket.disconnect", ws_disconnect),
]
channel_routing = [
include(chat_routing),
include(http_routing),
]
我希望我按照/ chatwindow链接使用普通视图并卸载聊天应用程序,但它不起作用。