fromfastapiimportFastAPIfromfastapi.middleware.wsgiimportWSGIMiddlewarefromflaskimportFlask,requestfrommarkupsafeimportescapeflask_app=Flask(__name__)@flask_app.route("/")defflask_main():name=request.args.get("name","World")returnf"Hello, {escape(name)} from Flask!"app=FastAPI()@app.get("/v2")defread_main():return{"message":"Hello World"}app.mount("/v1",WSGIMiddleware(flask_app))