Django channel version for Django 2.2 and Python 3.8.5

I am trying to use django channel inside my project but I am confused when I look into django channel tutorials because of different channel versions.
What is the correct django channel version for Django 2.2 and python 3.8?

Can I use channel 3.x or should I use 2.x?

Please let me know

Thanks

When I use channels 3.x and try to connect one of the url ws://192.168.10.85:8000/ws/session/.
I get this error

ERROR 2021-02-24 12:13:45,121 server Exception inside application: object.init() takes exactly one argument (the instance to initialize)
Traceback (most recent call last):
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/staticfiles.py”, line 44, in call
return await self.application(scope, receive, send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/routing.py”, line 71, in call
return await application(scope, receive, send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/security/websocket.py”, line 37, in call
return await self.application(scope, send, receive)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/sessions.py”, line 47, in call
return await self.inner(dict(scope, cookies=cookies), receive, send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/sessions.py”, line 254, in call
return await self.inner(wrapper.scope, receive, wrapper.send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/auth.py”, line 181, in call
return await super().call(scope, receive, send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/middleware.py”, line 26, in call
return await self.inner(scope, receive, send)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/routing.py”, line 150, in call
return await application(
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/asgiref/compatibility.py”, line 33, in new_application
instance = application(scope)
File “/home/nazar/Documents/Projects/Scorbit/scorbit_api/venv/lib/python3.8/site-packages/channels/generic/websocket.py”, line 23, in init
super().init(*args, **kwargs)
TypeError: object.init() takes exactly one argument (the instance to initialize)

I solved the issue by calling as_asgi on consumer.
And it seems like channels 3.x works fine with django 2.2

1 Like