(See Pull Requests and Issues for suggestions)
AWSGI allows you to use WSGI-compatible middleware and frameworks like Flask and Django with the AWS API Gateway/Lambda proxy integration.
awsgi
is available from PyPI as aws-wsgi
:
pip install aws-wsgi
import awsgi
from flask import (
Flask,
jsonify,
)
app = Flask(__name__)
@app.route('/')
def index():
return jsonify(status=200, message='OK')
def lambda_handler(event, context):
return awsgi.response(app, event, context, base64_content_types={"image/png"})