Werkzeug is primarily a library, not a web server, although it does provide a simple web server for development purposes. That development server is what's providing that Server: header.

To go into more detail:

First, let's talk about WSGI. There are a bunch of web servers out there, like Apache, Nginx, Lighttpd, etc. There are also a bunch of web frameworks written in Python, e.g. Django, Flask, Tornado, Pyramid, etc. It would be awfully convenient if these were all interoperable. That's where WSGI comes in. The idea is this:

  • There are two sides involved in responding to a client's HTTP request: the web server and the web application. The server handles the intricacies of the network connections, receiving the request, and sending the response. The application takes the request data, acts on it, and crafts the response for the server to send back.

  • If you want to write a Python web application, make sure it has a callable object (such as 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 apps, make it call that callable object from the application every time an HTTP request comes in.

  • The WSGI specification (in PEP 3333) specifies exactly what the parameters for that callable must be and what the return value should be, so every server knows how to talk to every application and vice versa.

So, we know that every web application needs to provide this callable and be able to handle the specific parameters it receives. Every application needs to do this... That sounds like a good opportunity to use a library. Werkzeug is this library.

Werkzeug provides a bunch of utilities for developing WSGI-compliant applications. These utilities do things like parsing headers, sending and receiving cookies, providing access to form data, generating redirects, generating error pages when there's an exception, even providing an interactive debugger that runs in the browser. It's really quite comprehensive. Flask then builds upon this foundation (and Jinja, Click, etc.) to provide a complete web framework.

So, if Werkzeug is a library for applications, why is it showing up in the server header?

Werkzeug does have a module for the server role as well. This is purely for convenience purposes.

Installing and configuring a full-fledged web server like Apache or Nginx is a lot of effort, and almost certainly overkill just for testing your application on your own development box. For that reason, Werkzeug provides a development server: a simple web server that you can run with a single command and almost no configuration. When you do flask run (or werkzeug.serving.run_simple()), this development server is what you are getting. And the Server: header for the development server is—you guessed it—Werkzeug/<version> Python/<version>.

This server isn't meant for production use. At the very least, according to the docs, it doesn't scale well. But I wouldn't be surprised if there were other concerns as well, such as security.

Answer from Dominick Pastore on Stack Overflow
Top answer
1 of 4
193

Werkzeug is primarily a library, not a web server, although it does provide a simple web server for development purposes. That development server is what's providing that Server: header.

To go into more detail:

First, let's talk about WSGI. There are a bunch of web servers out there, like Apache, Nginx, Lighttpd, etc. There are also a bunch of web frameworks written in Python, e.g. Django, Flask, Tornado, Pyramid, etc. It would be awfully convenient if these were all interoperable. That's where WSGI comes in. The idea is this:

  • There are two sides involved in responding to a client's HTTP request: the web server and the web application. The server handles the intricacies of the network connections, receiving the request, and sending the response. The application takes the request data, acts on it, and crafts the response for the server to send back.

  • If you want to write a Python web application, make sure it has a callable object (such as 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 apps, make it call that callable object from the application every time an HTTP request comes in.

  • The WSGI specification (in PEP 3333) specifies exactly what the parameters for that callable must be and what the return value should be, so every server knows how to talk to every application and vice versa.

So, we know that every web application needs to provide this callable and be able to handle the specific parameters it receives. Every application needs to do this... That sounds like a good opportunity to use a library. Werkzeug is this library.

Werkzeug provides a bunch of utilities for developing WSGI-compliant applications. These utilities do things like parsing headers, sending and receiving cookies, providing access to form data, generating redirects, generating error pages when there's an exception, even providing an interactive debugger that runs in the browser. It's really quite comprehensive. Flask then builds upon this foundation (and Jinja, Click, etc.) to provide a complete web framework.

So, if Werkzeug is a library for applications, why is it showing up in the server header?

Werkzeug does have a module for the server role as well. This is purely for convenience purposes.

Installing and configuring a full-fledged web server like Apache or Nginx is a lot of effort, and almost certainly overkill just for testing your application on your own development box. For that reason, Werkzeug provides a development server: a simple web server that you can run with a single command and almost no configuration. When you do flask run (or werkzeug.serving.run_simple()), this development server is what you are getting. And the Server: header for the development server is—you guessed it—Werkzeug/<version> Python/<version>.

This server isn't meant for production use. At the very least, according to the docs, it doesn't scale well. But I wouldn't be surprised if there were other concerns as well, such as security.

2 of 4
35

No it isn't

Werkzeug(WSGI library) is like a communicator between your python code and http nginx/apache server

Here is the Complete use case of Werkzeug WSGI:

WSGI has two sides: the "server" or "gateway" side (often a web server such as Apache or Nginx), and the "application" or "framework" side (the Python script itself). To process a WSGI request, the server side executes the application and provides environment information and a callback function to the application side. The application processes the request, returning the response to the server side using the callback function it was provided.

Between the server and the application, there may be a WSGI middleware, which implements both sides of the API. The server receives a request from a client and forwards it to the middleware. After processing, it sends a request to the application. The application's response is forwarded by the middleware to the server and ultimately to the client. There may be multiple middlewares forming a stack of WSGI-compliant applications.

Hope it helps

🌐
TestDriven.io
testdriven.io › blog › what-is-werkzeug
What is Werkzeug? | TestDriven.io
January 9, 2024 - Along the way, you'll develop your own WSGI-compatible application using Werkzeug to create a Flask-like web framework! This article assumes that you have prior experience with Flask. If you're interested in learning more about Flask, check out my course on how to build, test, and deploy a Flask application: ... You may have already noticed, but every time you install Flask, you also install the following dependencies: ... Flask is a wrapper around all of them.
Discussions

python - Why use werkzeug when there is flask - Stack Overflow
I am just curious to know as why should we use werkzeug when flask is there. Any specific reason to consider werkzeug over flask. More on stackoverflow.com
🌐 stackoverflow.com
March 31, 2016
Why do Python frameworks like Flask need a WSGI (Werkzeug) but not Node.js?
WSGI/ASGI do the job of intercepting requests and dispatching it to your app. There is no reason to have it built in the language. I don't know how they did that, but there is an high chance that node have it integrated with libraries and not as an external app. (You can call the WSGI server from python directly). But, in the same way you can use different WSGI/ASGI servers in python, you can use different interpreters (node, deno, bun). More on reddit.com
🌐 r/learnprogramming
2
4
September 26, 2024
What is Werkzeug?
Good article ( testdriven.io usually are). More on reddit.com
🌐 r/flask
1
52
April 5, 2021
python - Could you explain more detailed differences between mod_wsgi and werkzeug? (SOS newbies) - Stack Overflow
I also reviewed werkzeug can run simple service which is implemented within its sources(make_server in serving.py). I aware that werkzeug has useful features and simple server feature. What I want to know it the below. When using Flask like framework based on werkzeug under Apache web server, ... More on stackoverflow.com
🌐 stackoverflow.com
People also ask

What is Python Werkzeug?
Werkzeug (German for "tool") is a BSD-licensed utility package for the Python programming language, essentially a toolkit for Web Server Gateway Interface (WSGI) applications. Software objects for request, response, and utility functions can be created with Werkzeug.
🌐
learnvern.com
learnvern.com › python flask course - create a complete website › werkzeug in flask
WerkZeug in Flask for Web Development
What is Werkzeug logging?
Werkzeug is a WSGI web application library with a lot of features. There are no dependencies enforced by Werkzeug. The developer has complete control over the template engine, database adapter, and even how requests are handled.
🌐
learnvern.com
learnvern.com › python flask course - create a complete website › werkzeug in flask
WerkZeug in Flask for Web Development
🌐
Beautiful Soup
tedboy.github.io › flask › werk_doc.tutorial.html
1. Werkzeug Tutorial — Flask API
A WSGI application is something you can call and pass an environ dict and a start_response callable. The environ contains all incoming information, the start_response function can be used to indicate the start of the response. With Werkzeug you don’t have to deal directly with either as request and response objects are provided to work with them.
🌐
Quora
quora.com › What-should-I-learn-first-Flask-Pyramid-Django-or-Werkzeug
What should I learn first: Flask, Pyramid, Django, or Werkzeug? - Quora
Answer (1 of 3): Werkzeug is a very basic API that almost certainly won’t be enough to make websites. Flask is based on Werkzeug and provides a more extensive API that, in my opinion, provides just the right amount of tools without getting in your way. Django provides a very extensive API that ...
Find elsewhere
🌐
TestDriven.io
testdriven.io › tips › b8604459-e836-47f9-8c6c-f22f9420b39e
Tips and Tricks - What is Werkzeug? | TestDriven.io
Werkzeug (a key component of Flask) provides a set of utilities for creating a Python application that can talk to a WSGI server (e.g., Gunicorn).
🌐
LearnVern
learnvern.com › python flask course - create a complete website › werkzeug in flask
WerkZeug in Flask for Web Development
Flask wraps Werkzeug, allowing it to take care of the WSGI intricacies while also offering extra structure and patterns for creating powerful applications. Werkzeug is a WSGI utility library for Python.
Published   January 24, 2022
🌐
Reddit
reddit.com › r/learnprogramming › why do python frameworks like flask need a wsgi (werkzeug) but not node.js?
r/learnprogramming on Reddit: Why do Python frameworks like Flask need a WSGI (Werkzeug) but not Node.js?
September 26, 2024 -

Flask uses a 3rd party WSGI, Django has its own WSGI, and FastAPI uses a ASGI. But i've never seen those terms mentioned when reading about Nest.js or Node or Express. Why?

🌐
Werkzeug
werkzeug.palletsprojects.com
Werkzeug — Werkzeug Documentation (3.1.x)
Werkzeug is a comprehensive WSGI web application library.
🌐
Pallets
palletsprojects.com › p › werkzeug
Werkzeug | The Pallets Projects
It began as a simple collection ... WSGI utility libraries. Flask wraps Werkzeug, using it to handle the details of WSGI while providing more structure and patterns for defining powerful applications....
🌐
Medium
medium.com › @DaveLumAI › werkzeug-the-python-power-tool-that-thinks-its-a-swiss-army-knife-7f78c474aa79
Werkzeug: The Python Power Tool That Thinks It’s a Swiss Army Knife | by Dave LumAI | Medium
July 17, 2025 - Werkzeug is a comprehensive WSGI (Web Server Gateway Interface) utility library for Python. It’s not a full web framework like Flask or Django.
🌐
Patricksoftwareblog
patricksoftwareblog.com › what_is_werkzeug.html
What is Werkzeug? | Patrick's Software Blog
April 5, 2021 - Along the way, you'll develop your own WSGI-compatible application using Werkzeug to create a Flask-like web framework!
🌐
Medium
themanoftalent.medium.com › werkzeug-e749fcfedb4e
Werkzeug - Mehmet Akif Cifci - Medium
March 18, 2023 - Werkzeug is a Python web application library that provides tools for building web applications. It was initially developed as part of the Flask web framework but can also be used independently of Flask.
🌐
Palletsprojects
palletsprojects.com › projects › werkzeug
Werkzeug
It is up to the developer to choose ... such as blogs, wikis, or bulletin boards. Flask wraps Werkzeug, using it to handle the details of WSGI while providing more structure and patterns for defining powerful applications....
🌐
Reddit
reddit.com › r/flask › what is werkzeug?
r/flask on Reddit: What is Werkzeug?
April 5, 2021 - 92K subscribers in the flask community. Flask is a Python micro-framework for web development. Flask is easy to get started with and a great way to…
Top answer
1 of 2
29

WSGI stands for Web Server Gateway Interface, (mostly) defined by PEP 333 at http://www.python.org/dev/peps/pep-0333/ .

It is an effort by the Python community to establish a standard mechanism for web servers to speak to Python applications.

In theory, any wsgi compliant server (or extension to an existing web server) should be able to load and run any wsgi compliant application.

werkzeug is a web application framework which can run under a compliant WSGI server, such as Apache+mod_wsgi. It also contains a built-in development server that you can use for development.


WSGI can be very confusing at first, but it is actually pretty simple. The WSGI spec requires that your python application do the following:

  1. define a callable named application
  2. said callable should accept 2 parametes: (environ, start_response)
  3. environ is a dictionary of environment variables
  4. start_response is a callable that needs called to start the response

Once application is called, then it handles the request, builds the output, and:

  1. calls start_response('200 OK', Headers)
  2. return [content]

A simple WSGI app might look like this:

def application(environ, start_response):
    status = '200 OK'
    output = 'Hello World!'

    response_headers = [('Content-type', 'text/plain'),
                    ('Content-Length', str(len(output)))]
    start_response(status, response_headers)

    return [output]

It is strongly suggested that you use an existing WSGI framework, as there are a lot of details involved in parsing HTTP requests, handling file uploads, encoding characters, etc...

Take a look at Bottle, Flask, werkzeug, AppStruct, etc...

2 of 2
15

mod_wsgi is a wsgi compliant python module that bridges python and apache. it lets you run applications coded to the wsgi spec under apache.

werkzeug is a wsgi utility library, used to build wsgi compliant applications. it ships with a development server.

there are a handful of Python Web Application Frameworks: Pyramid/Pylons, Flask, Bottle, Django, CherryPy, etc etc. They all implement the WSGI spec, which is the de-facto standard for building web applications in Python ( http://en.wikipedia.org/wiki/Web_Server_Gateway_Interface )

Most web application frameworks ship with a debug-only or production-capable web server. When you have a WSGI app, you can serve via the library's app, through Apache via mod_wsgi, or using a 'pure' wsgi server like uWSGI , gunicorn, fapws, or twisted.

Most people I know will deploy a wsgi app like this:

  • a lightweight server , like nginx, listens on port80
  • the lightweight server serves static files itself
  • the lightweight server proxies uWSGI requests to another server, which is often uWSGI, but sometimes apache+mod_wsgi or another. depending on the setup, the proxying can either be an http proxy or connecting to the uWSGI server directly or through a socket.

with that being said, to specifically answer your question, read the first paragraph of this docs page - http://werkzeug.pocoo.org/docs/serving/ :

There are many ways to serve a WSGI application. While you’re developing it, you usually don’t want to have a full-blown webserver like Apache up and running, but instead a simple standalone one. Because of that Werkzeug comes with a builtin development server.

For development reasons, or on a very low traffic site, you can just use the Werkzeug server. If you're deploying an application that will get a reasonable amount of traffic, you'll want something more robust.

mod_wsgi or uWSGI duplicate the serving features of Werkzeug , but they do it because they can do it considerably better - faster response times, lower memory , better concurrency, more stable, etc etc etc. the Werkzeug server is "good enough" for many uses, but its not "the best way" to serve a wsgi compliant app.

🌐
LibHunt
libhunt.com › compare-werkzeug-vs-mitsuhiko--flask
Werkzeug vs flask - compare differences and reviews? | LibHunt
Werkzeug (library used by Flask) had a repr for its sentinel long before getting type annotations. ... Flask getting async support is a huge step for the asyncio web ecosystem in Python.