2
  • While implementing channels feature in DRF I migrated from WSGI to ASGI.
  • So currently I have REST API and channels in same project->same app.
  • Channels are working and existing APIs as well except ones with async def in it

Im getting error below -

RuntimeError: You cannot use AsyncToSync in the same thread as an async event loop - just await the async function directly.

Since this method is called in a view which not async I cannot await while calling function. Im assuming the WSGI->ASGI migration is cause of this break.

HELP PLEASE!!

NotABot
  • 781
  • 7
  • 24
  • I couldn't find ideal solution yet. For now, I ended up creating 2 apps - 1 for REST (WSGI/gunicorn) and 2nd for channel (ASGI/daphne). – NotABot Dec 28 '21 at 12:15

0 Answers0