Files
azfzagnetdoc/function_app.py
T
2026-03-14 16:34:36 +00:00

15 lines
543 B
Python

"""
Azure Function App 入口
将 FastAPI 应用挂载为 ASGI,用于部署到 Azure 函数应用(非 AKS)。
本地运行: func start
部署后: https://<your-function-app>.azurewebsites.net/
"""
import azure.functions as func
from src.server.api_server import app as fastapi_app
# 挂载 FastAPI 为 ASGI,所有 HTTP 请求由 FastAPI 处理
# ANONYMOUS: 允许匿名调用;生产环境可在 Azure 门户改为 FUNCTION 并配合密钥/APIM
app = func.AsgiFunctionApp(app=fastapi_app, http_auth_level=func.AuthLevel.ANONYMOUS)