Werkzeug
Werkzeug is a comprehensive WSGI web application library, currently at version 3.1.7, released on March 28, 2026. It offers a wide range of utilities for building web applications in Python, with a release cadence of regular updates addressing both features and fixes.
Warnings
- breaking Deprecation of top-level attributes in 'werkzeug' module; direct imports are now required.
- gotcha Relative imports can break import paths; prefer absolute imports to avoid issues.
Install
-
pip install werkzeug
Imports
- wrap_file
from werkzeug.wsgi import wrap_file
- url_quote
from werkzeug.urls import url_quote
Quickstart
from werkzeug.wrappers import Request, Response
from werkzeug.serving import run_simple
def application(environ, start_response):
request = Request(environ)
response = Response('Hello, World!', mimetype='text/plain')
return response(environ, start_response)
if __name__ == '__main__':
run_simple('localhost', 4000, application)