Werkzeug is primarily a library, not a web server, although it provides a simple web server for development purposes. It is this development server that provides the Server: header.
To go to more detail:
First, let's talk about WSGI. There are many web servers like Apache, Nginx, Lighttpd, etc. There are also several web frameworks written in Python, for example. Django, Infusion, Tornado, Pyramid, etc. It would be very convenient if they were all compatible. This is where the WSGI comes in. The idea is this:
When responding to a clientβs HTTP request, two parties are involved: the web server and the web application . The server processes the intricacies of network connections, receives a request, and sends a response. The application receives the request data, processes it and creates a response for sending by the server back.
If you want to write a Python web application, make sure that it has a callable object (for example, a function) that accepts certain parameters for HTTP headers, input form data, environment variables, etc.
If you want to write a web server that serves Python applications, force it to call this called object from the application every time an HTTP request arrives.
The WSGI specification (in PEP 3333 ) defines exactly what the parameters for this called object should be and what the return value should be so that each server knows how to communicate with each application and vice versa.
So, we know that every web application must provide this called object and be able to process certain parameters that it receives. Every application should do this ... It sounds like a good opportunity to use the library. Werkzeug is a library.
Werkzeug provides a set of utilities for developing applications compatible with WSGI. These utilities perform functions such as parsing headers, sending and receiving cookies, providing access to form data, creating redirects, creating error pages when an exception occurs, even providing an interactive debugger that runs in the browser. It is really quite comprehensive. Flask is then built on this foundation (and Jinja, Click, etc.) to provide a complete web environment.
So, if Werkzeug is a library for applications, why is it displayed in the server header?
Werkzeug also has a module for the server role. This is for convenience only.
Installing and setting up a full-fledged web server, such as Apache or Nginx, requires a lot of effort and is almost certainly unnecessary due to the fact that you are testing your application on your own development platform. For this reason, Werkzeug provides a development server: a simple web server that can be launched with a single command and with little or no configuration. When you do flask run (or werkzeug.serving.run_simple() ), you get exactly this development server. And the Server: header Server: for the development server - & - you guessed it - Werkzeug/<version> Python/<version> .
This server is not intended for production use. At least according to the docs, it doesn't scale very well. But I wonβt be surprised if there are other problems, such as security.