我有一个简单的python模块添加符号,我不想在任何地方公开发布它。我还有一个Azure Python无服务器函数应用程序示例PythonserverlessFunction我想在Azure上发布。
我遵循官方文件:
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-functions-functions-functe-first-function-function-python
- https://learn.microsoft.com/en-us/azure/azure-functions/functions-refernions-referend-python
和一个外的页面https://prmadi.com/install-python-modules-on-azure-app-services/
最后,我的Azure功能项目中有一个wheelhouse
目录,其中包含我需要的每个依赖项的*.whl
文件。我尝试将其他标志放在我的requirments.txt
文件中以使用wheelhouse
目录而不是索引。这是我的requirments.txt
文件的内容。
--no-index --find-links file://wheelhouse
Additional-Library==1.0
azure-functions==1.0.0b4
azure-functions-worker==1.0.0b6
grpcio==1.20.1
grpcio-tools==1.20.1
protobuf==3.6.1
six==1.11.0
在发布应用程序时:
$ func azure functionapp publish ${APP_NAME} --build-native-deps
我有一个错误:
Url 'file://wheelhouse' is ignored: it is neither a file nor a directory.
我无法安装依赖项。那方式是正确的吗?我如何为Azure函数应用程序安装一些其他依赖项。
任何帮助和建议将不胜感激。
我一直在这样做:
import os
import sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname( __file__ ), '../../../az/Lib/site-packages')))
from azure.storage.cloudstorageaccount import CloudStorageAccount,AccountPermissions,Services,ResourceTypes
from azure.storage.blob import BlockBlobService
因此,您可以在功能中创建一个目录,然后将其添加到该路径的路径和导入模块中。