所以为了能在 Python Function 中使用 psycopg2 模块,需要在 requirements.txt 文件中,使用 psycopg2-binary 代替 psycopg2。 其他的(如代码中的 import psycopg2)则无需修改。 参考资料 在Azure 中使用 Visual Studio Code 创建 Python 函数:https://docs.azure.cn/zh-cn/azure-functions/create-first-function-vs-...
在Azure中创建Function App(函数应用), 用以运行Python代码(Python Version 3.7)。 通过VS Code创建一个HttpTrigger的Function,其中使用到了 psycopg2 模块,以便连接 Azure Database for PostgreSQL 数据库 当通过VS Code发布到Azure后,请求 Function URL 出错。通过高级工具(Kudu:https://<xxxxxxxx>.scm.chinacloudsi...
在Azure中创建Function App(函数应用), 用以运行Python代码(Python Version 3.7)。 通过VS Code创建一个HttpTrigger的Function,其中使用到了 psycopg2 模块,以便连接 Azure Database for PostgreSQL 数据库 当通过VS Code发布到Azure后,请求 Function URL 出错。通过高级工具(Kudu:https://<xxxxxxxx>.scm.chinacloudsi...
一些开发人员使用pip freeze > requirements.txt为其开发环境生成 Python 包列表。 尽管这种便捷做法在大多数情况下都是可行的,但在跨平台部署方案中可能会出现问题,例如在 Windows 或 macOS 本地开发函数,但发布到在 Linux 上运行的函数应用。 在此方案中,pip freeze可能会引入特定于操作系统的意外依赖项或本地开发...
但是当前问题,并不是没有尝试安装psycopg2这个模块,而是虽然在Function的 requirements.txt 文件中已经添加了psycopg2,但是在安装的过程中出错。为了更明确的知道错误的消息,直接SSH连接到Function App所运行的Linux实例。通过 python -m pip install psycopg2 查看错误信息: ...
将azurefunctions-extensions-bindings-blob 扩展包添加到项目的 requirements.txt 文件中,其中至少应包括以下包: text 复制 azure-functions azurefunctions-extensions-bindings-blob 将以下代码添加到项目的 function_app.py 文件中,将导入 SDK 类型绑定: Python 复制 import azurefunctions.extensions.bindings.blob ...
第一:确保 requirements.txt包含下面二行内容 azure-functions azure-functions-durable 第二: 打开 VS Code的 Terminal命令行,在Function目录下运行下面几行命令: python -m pip install -r requirements.txt python.exe -m pip install --upgrade pip
第一: 确保 requirements.txt 包含下面二行内容 azure-functions azure-functions-durable 第二: 打开 VS Code 的 Terminal 命令行,在Function目录下运行下面几行命令: python -m pip install -r requirements.txt python.exe -m pip install --upgrade pip ...
第一: 确保 requirements.txt 包含下面二行内容 azure-functions azure-functions-durable 第二: 打开 VS Code 的 Terminal 命令行,在Function目录下运行下面几行命令: python -m pip install -r requirements.txt python.exe -m pip install --upgrade pip ...
The language or language stack of the worker runtime to load in the function app. This corresponds to the language being used in your application (for example, python). Starting with version 2.x of the Azure Functions runtime, a given function app can only support a single language....