{"id":24840,"library":"wsgiref","title":"wsgiref","description":"wsgiref is the WSGI (PEP 333) reference implementation, included in the Python standard library. It provides utilities for developing and testing WSGI applications, including a simple HTTP server and request/response objects. Version 0.1.2 on PyPI is outdated; the standard library version is bundled with Python 3.x. Use the standard library module instead of the PyPI package to avoid conflicts.","status":"deprecated","version":"0.1.2","language":"python","source_language":"en","source_url":"https://github.com/python/cpython/blob/main/Lib/wsgiref/","tags":["wsgi","reference","std-lib"],"install":[{"cmd":"pip install wsgiref","lang":"bash","label":"Install via pip"}],"dependencies":[],"imports":[{"note":"Incorrect: make_server is a function, not a module. Correct import: from wsgiref.simple_server import make_server","wrong":"from wsgiref.simple_server import make_server","symbol":"simple_server","correct":"from wsgiref import simple_server"},{"note":"Same, but acceptable: import wsgiref.util is also valid.","wrong":"import wsgiref.util","symbol":"util","correct":"from wsgiref import util"}],"quickstart":{"code":"from wsgiref.simple_server import make_server\n\ndef hello_app(environ, start_response):\n    status = '200 OK'\n    headers = [('Content-type', 'text/plain')]\n    start_response(status, headers)\n    return [b'Hello World']\n\nwith make_server('', 8000, hello_app) as httpd:\n    print('Serving on port 8000...')\n    httpd.serve_forever()","lang":"python","description":"Basic WSGI application using wsgiref's simple server."},"warnings":[{"fix":"Remove wsgiref from requirements.txt. Use: from wsgiref.simple_server import make_server","message":"The PyPI package 'wsgiref' is outdated and should not be used. Instead, import from the Python standard library's wsgiref module, which is bundled with Python 3.x.","severity":"deprecated","affected_versions":"all"},{"fix":"For production, use a production-grade server like Gunicorn or uWSGI.","message":"wsgiref is for development and testing only; not suitable for production. Traps SIGINT, so pressing Ctrl+C may not stop the server gracefully on some platforms.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Upgrade Python to 2.5 or later, or use the PyPI package (not recommended).","cause":"Using an outdated Python version (prior to 2.5) where wsgiref was not in the standard library.","error":"ImportError: No module named wsgiref"},{"fix":"Uninstall the PyPI package: pip uninstall wsgiref. Then use the standard library module.","cause":"Trying to import wsgiref.simple_server when the PyPI package is installed and shadows the standard library, which may have different structure.","error":"AttributeError: module 'wsgiref' has no attribute 'simple_server'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}