- Change host.json to remove the http prefix
"extensions": {
"http": {
"routePrefix": ""
}
}
- Change FlaskAppTrigger/function.json to enable HTTP verbs
{
"scriptFile": "__init__.py",
"bindings": [
{
"authLevel": "anonymous",
"type": "httpTrigger",
"direction": "in",
"name": "req",
"methods": [
"get",
"post",
"put",
"delete"
],
"route": "/{*route}"
},
{
"type": "http",
"direction": "out",
"name": "$return"
}
]
}
- Migrate your flask app into FlaskApp/ folder.
- Change module import statements, FlaskApp/app.py for guidance.
import azure.functions as func
from FastapiApp import app
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.AsgiMiddleware(app).handle(req, context)
or
import azure.functions as func
from FlaskApp import app
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.WsgiMiddleware(app.wsgi_app).handle(req, context)