This is a short story which will give you an idea about what is WSGI and ASGI.

Image for post

Source

Before 2003 Python had a wide variety of web application frameworks such as Zope, Quixote, Webware, SkunkWeb etc. But the problem was for new python users that they have to chose a frame work from above which limit their choice of usable web servers, vice versa. Thus the framework WSGI is released.

WSGI

WSGI is a standard interface which allows to seperate server code from the application code where you add your business logic. WSGI succeeded in allowing much more freedom and innovation in the Python web space.

In WSGI applications takes a single request and returns response at a time. This single and synchronous callable limits WSGI for long lived connections like websocket connections. Even if we made the application asynchronous callable it only has a single path to provide request.

Image for post

Source

WSGI (stands for Web Server Gateway Interface) is simple where you can define your application as a callable that takes two arguments the first argument environ describes the request and the environment the server running in and the second argument is a synchronous callable which you call to start the response to yield the body.

There are a lots of WSGI frameworks Bottle, Flask, Falcon, Django etc. There are WSGI servers like Gunicorn, uWSGI, Apache.

#wsgi #python #asgi #web-framework #application-frameworks

Difference between WSGI and ASGI ?
54.30 GEEK