Django channels error when attempting to serve static files with devserver

Viewed 780

I moved my project into another environment and after installing the dependencies and attempting to run the manage.py runserver - devserver I get the following error when static files are requested. Quite frankly i'm completely lost with this error, has anyone an idea what this is about?

    HTTP GET /static/admin/css/responsive.css 500 [0.21, 127.0.0.1:59982]
Exception inside application: async_to_sync can only be applied to async functions.
Traceback (most recent call last):
  File "/home/maxehleny/.local/share/virtualenvs/mysite-EdbyOLs2/lib/python3.6/site-packages/channels/staticfiles.py", line 41, in __call__
    dict(scope, static_base_url=self.base_url), receive, send
  File "/home/maxehleny/.local/share/virtualenvs/mysite-EdbyOLs2/lib/python3.6/site-packages/channels/staticfiles.py", line 56, in __call__
    return await super().__call__(scope, receive, send)
  File "/home/maxehleny/.local/share/virtualenvs/mysite-EdbyOLs2/lib/python3.6/site-packages/channels/http.py", line 198, in __call__
    await self.handle(scope, async_to_sync(send), body_stream)
  File "/home/maxehleny/.local/share/virtualenvs/mysite-EdbyOLs2/lib/python3.6/site-packages/asgiref/sync.py", line 105, in __init__
    raise TypeError("async_to_sync can only be applied to async functions.")
TypeError: async_to_sync can only be applied to async functions.

I have got little to no idea where the issue could lie since I don't see how this coming up relates to my own code. If I comment out channels everything else works fine.

Edit2 downgrading to asgiref==3.2.10 as per ladruas answer worked for me aswell.

There seems to be an incompatibility between channels==3.0.3 asgiref==3.3.10

1 Answers

I added asgiref==3.2.10 to my requirements.txt file and it seems to have solved the problem.

Related