python-3.x - 尝试在 vscode 中执行 azure 函数
问题描述
我一直在尝试部署具有 azure 功能的烧瓶应用程序。它不工作。我是天蓝色的新手...
我的烧瓶应用程序是一个简单的计算器,我想在线使用 azure 函数。我的文件目录如下:
flaskapp
|-flask application;
|-index.html
azure_function:HTTP trigger function
|-__init__.py
|-function.json
这是我的初始化.py
def main(req: func.HttpRequest, context: func.Context) -> func.HttpResponse:
return func.WsgiMiddleware(application).handle(req, context)
当我尝试在 vs 代码中本地调试我的函数时,我无法使其工作:找不到 404。当我执行函数时,我得到:执行函数“functionName”。回复:"<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> <title>404 Not Found</title> <h1>Not Found</h1> <p>The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.</p> "
有人能帮助我吗?
解决方案
这个问题需要更多细节。
404 Not found 错误总是意味着你错过了一些基本的东西。本地烧瓶应用程序的默认端口与本地的azure函数不同(azure函数为7071)。
并且 debug azure function 不仅仅意味着 debug __init__.py
。其实就是调试整个函数应用(要实现这个,需要安装azure函数核心工具,VSCode的azure函数插件和语言调试插件)。
推荐阅读
- javascript - 使用 javascript 使用 Gmail API 显示邮件内容
- python - Gensim Mallet Wrapper:如何获取所有文档的主题权重?
- html - 如何使用nodejs在客户端下载文件
- amazon-web-services - 当服务(在 ecs fargate 上)返回 503 时,AWS 弹性负载均衡器能否将请求重定向到 lambda 函数
- list - 为什么 ++= 不能在 Scala 中使用相同的列表?
- ssl - CSR 是否使用私钥加密?
- python - 有没有办法将 pandas 数据框和单独的字符串 var 存储在同一个 SQLite 表中?
- excel - 如何在excel中的同一列上使用2色标来表示多个条件?
- go - Entr 未重新启动服务器
- reactjs - 我需要一个异步函数来正确包含一个工作的预加载器组件吗?