What would be WSGI?

Asked

Viewed 926 times

7

I was reading about the term WSGI to understand a little more the operation of web applications in Python, and I realized that some microframeworks like Flask uses this technology.

However, I still remain confused about the WSGI, it seems that I did not understand very well his proposal or what he is in fact. I’d like you to answer a few questions about.

Questions

  1. What is WSGI?
  2. What relationship does it have with my web application?
  3. WSGI is only for Python?
  • 1

    I predict a jsbueno response in 5... 4... 3..

1 answer

4


  1. What is WSGI?

"Web Server Gateway Interface"... is a layer that lies between the web server and your application.

  1. What relationship does it have with my web application?

You have to develop your application according to the interface specification. Here’s how it works: Instead of developing your application by making it chat using the HTTP protocol directly with your browser (Opening sockets and etc) you leave this task to the web server, and provide only one function.

The WSGI web server will receive requests from the browser and call its function automatically, passing the request data... And you just have to write the logic to return the answer.

If your web application follows the WSGI, it can be used on any web server that supports WSGI as well. In addition there are middleware which are like plugins, can be placed in any WSGI application.

  1. WSGI is only for Python?

Yes, the WSGI specification assumes that you should write a python function that will be called by the server.

Nowadays most python frameworks such as Django, Pylons, flask support WSGI format, so developed applications can be published on any WSGI server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.