Search code examples
pythonpython-asynciosanic

Reasons For Python Sanic or Async Frameworks To Use Asgiref?


I understand the answer is "always depends", but generally speaking would there be a reason to use asgiref wrapper within Async frameworks such as Sanic.

https://github.com/django/asgiref https://github.com/channelcat/sanic

My main question is, why would anyone uses this within an async framework, I understand the use case for Django, but if you're async programming is thought through, something like this seems a bit of an lazy way to handle a problem.

Tell me I'm wrong.


Solution

  • I am not familiar with asgiref in particular. However, with that said, I am familiar with the idea of asgi to sort of be a replacement for wsgi.

    In terms of Sanic, this is sort of irrelevant. Sanic has its own server built in, and it operates asynchronously out of the box.

    I don't want to tell you that you are wrong per se, but I do not see a use for it in the Sanic world.