{"library":"serverless-wsgi","title":"Serverless WSGI","description":"Serverless WSGI is a Python library and Serverless Framework plugin that enables the deployment of standard Python WSGI applications (like Flask, Django, Pyramid) to AWS Lambda, using API Gateway as the HTTP frontend. It transparently converts API Gateway requests to WSGI requests and vice-versa, handling packaging and deployment complexities. The current version is 3.1.0, and it is actively maintained with regular updates.","language":"python","status":"active","last_verified":"Fri May 22","install":{"commands":["pip install serverless-wsgi","npm install serverless-wsgi"],"cli":{"name":"serverless","version":"sh: 1: serverless: not found"}},"imports":["import serverless_wsgi\n\ndef lambda_handler(event, context):\n    from your_app_module import app # Your WSGI application instance\n    return serverless_wsgi.handle_request(app, event, context)"],"auth":{"required":false,"env_vars":[]},"quickstart":{"code":"import os\nimport serverless_wsgi\nfrom flask import Flask, jsonify\n\n# Your Flask (or any WSGI) application\napp = Flask(__name__)\n\n@app.route('/')\ndef hello():\n    return jsonify(message='Hello from Serverless WSGI!')\n\n@app.route('/env')\ndef show_env():\n    return jsonify(environment=dict(os.environ))\n\n# The AWS Lambda handler function\ndef lambda_handler(event, context):\n    # This is the core function from the serverless-wsgi Python library\n    # that maps API Gateway events to your WSGI application.\n    return serverless_wsgi.handle_request(app, event, context)\n\n# Example of how you would run it locally (for testing)\nif __name__ == '__main__':\n    # In a real setup, this is handled by `sls wsgi serve` or a WSGI server.\n    # For a minimal local test, you could use Werkzeug's run_simple.\n    from werkzeug.serving import run_simple\n    print(\"Running local Flask app on http://127.0.0.1:5000/\")\n    run_simple('127.0.0.1', 5000, app, use_reloader=True, use_debugger=True)","lang":"python","description":"This quickstart demonstrates how to integrate `serverless-wsgi` with a simple Flask application for direct use within an AWS Lambda function. The `lambda_handler` function serves as the entry point, passing the AWS event and context to `serverless_wsgi.handle_request`. For actual deployment, the `serverless-wsgi` plugin for the Serverless Framework is typically used, which abstracts away the manual `lambda_handler` setup by configuring `wsgi_handler.handler` in your `serverless.yml`.","tag":null,"tag_description":null,"last_tested":null,"results":[]},"compatibility":{"tag":null,"tag_description":null,"last_tested":"2026-05-22","installed_version":"3.1.0","pypi_latest":"3.1.0","is_stale":false,"summary":{"python_range":"3.10–3.9","success_rate":100,"avg_install_s":1.8,"avg_import_s":0.25,"wheel_type":"wheel"},"results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.23,"mem_mb":7.2,"disk_size":"19.6M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.2,"mem_mb":7.2,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.33,"mem_mb":8.1,"disk_size":"21.8M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.8,"import_time_s":0.28,"mem_mb":8.1,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.3,"mem_mb":7.7,"disk_size":"13.6M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.29,"mem_mb":7.9,"disk_size":"14M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.25,"mem_mb":7.9,"disk_size":"13.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":1.6,"import_time_s":0.25,"mem_mb":7.9,"disk_size":"14M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":null,"import_time_s":0.17,"mem_mb":7.3,"disk_size":"19.1M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"serverless-wsgi","exit_code":0,"wheel_type":"wheel","failure_reason":null,"import_side_effects":"clean","install_time_s":2,"import_time_s":0.16,"mem_mb":7.3,"disk_size":"20M"}]}}