2

I was trying to use channels in Django, To do that I followed a tutorial and made these changes in the asgi.py file

from channels.routing import ProtocolTypeRouter
application = ProtocolTypeRouter(
{
    "http":get_asgi_application()
})

and these in the settings.py file

ASGI_APPLICATION = 'lostAndFound.wsgi.application'

after that, i restarted the server and got an internal server error, and the error in the terminal

`Exception inside application: WSGIHandler.__call__() takes 3 positional arguments but 4 were given

Traceback (most recent call last): File "/home/alaa/.local/lib/python3.10/site-packages/channels/staticfiles.py", line 44, in call return await self.application(scope, receive, send) TypeError: WSGIHandler.call() takes 3 positional arguments but 4 were given`

can anyone plese help me with this

th3plus
  • 161
  • 2
  • 11

2 Answers2

0

Do you import it : from django.core.asgi import get_asgi_application

viduvern
  • 93
  • 5
  • yeah it's imported in the asgi.py fille – th3plus May 17 '22 at 17:15
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community May 18 '22 at 05:33
  • i mean i just didn't write it in the code that i have provided but it's in my project – th3plus May 21 '22 at 03:05
0

You have a typo in settings:

# You have "wsgi"
ASGI_APPLICATION = 'testproject.wsgi.application'
                                ^
                                |   
# And it should be "asgi"       v      
ASGI_APPLICATION = 'testproject.asgi.application'

Therefore the server does not work, because it expects to have asgi views provided (with different signature), and you feed wsgi in.

Jack L.
  • 1,257
  • 2
  • 17
  • 37