Skip to content

Hazhzeng/functions-wsgi

Repository files navigation

  1. Change host.json to remove the http prefix
"extensions": {
  "http": {
    "routePrefix": ""
  }
}
  1. 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"
    }
  ]
}
  1. Migrate your flask app into FlaskApp/ folder.
  2. 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)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages