'AttributeError: type object 'ChatConsumer' has no attribute 'as_asgi()
from django.urls import re_path
from . import consumers
websocket_urlpatterns = [
re_path(r'ws/chat/(?P<room_name>\w+)/$',consumers.ChatConsumer.as_asgi()),]
getting error of as_asgi()
Solution 1:[1]
This is because of the version of 'channels'. check the channels version of your channels. It is working with channels 3.0.1. If you had downgraded your channels-redis, channels also will get downgraded.
Solution 2:[2]
Use channels==3.0.1
& you are good to go.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | Danish |
Solution 2 | Christopher Nolan |