I am getting the following error when adding channels in Django.
Exception inside application: init() takes 1 positional argument When adding ASGI_APPLICATION in Django 3.1 for channels
Exception inside application: __init__() takes 1 positional argument but 2 were given
Traceback (most recent call last):
File "/home/dell/Desktop/s/s/s-env/lib/python3.6/site-packages/channels/staticfiles.py", line 44, in __call__
return await self.application(scope, receive, send)
File "/home/dell/Desktop/s/s/s-env/lib/python3.6/site-packages/channels/routing.py", line 71, in __call__
return await application(scope, receive, send)
File "/home/dell/Desktop/s/s/s-env/lib/python3.6/site-packages/channels/routing.py", line 160, in __call__
send,
File "/home/dell/Desktop/s/s/s-env/lib/python3.6/site-packages/asgiref/compatibility.py", line 33, in new_application
instance = application(scope)
TypeError: __init__() takes 1 positional argument but 2 were give
The application works fine on WSGI configuration.The above error only appears when ASGI_APPLICATION = 'app.routing.application' is added.
Since it's showing error originating from static files, I have tried generating static files again but that doesn't help.
I am using default django asgi file:
"""
ASGI config for mevsyou project.
It exposes the ASGI callable as a module-level variable named ``application``.
For more information on this file, see
https://docs.djangoproject.com/en/3.0/howto/deployment/asgi/
"""
import os
from django.core.asgi import get_asgi_application
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 's.settings.local')
application = get_asgi_application()
s/routing.py:
from channels.routing import ProtocolTypeRouter, URLRouter
from users import routing
application = ProtocolTypeRouter({
'http': URLRouter(routing.urlpatterns),
})