bottlepy / bottle

bottle.py is a fast and simple micro-framework for python web-applications.
http://bottlepy.org/
MIT License
8.37k stars 1.46k forks source link

Support ASGI alongside WSGI #1207

Closed rpuntaie closed 4 years ago

rpuntaie commented 4 years ago

I have only found ASGI mentioned in #1198.

ASGI will replace WSGI on the long run. There is a lot going on regarding ASGI, although it is not a PEP yet. It is of course, because async support is essential for Python web frameworks to keep up with other languages.

Could bottle support ASGI alongside WSGI?

Servers do want to support both (e.g. https://github.com/benoitc/gunicorn/issues/1380).

defnull commented 4 years ago

No. ASGI is fundamentally different from WSGI and it makes much more sense to use a specialized async framework instead of patching existing frameworks beyond recognition. Supporting both blocking and async methods at the same time is almost impossible to get right at the API level, and a pain to implement. If you really need async application logic (everything else is already async with most WSGI servers), and gevent does not work for you, just switch to a fully async framework.

That said, I disagree that WSGI will go away or that ASGI is 'the only future'. There is a place for both, and it is easy to run WSGI on top of ASGI if you really want to. So bottle will continue to work even if I'm wrong about that.