当main.py和requirements.txt不在同一目录中时如何部署谷歌云功能

ark*_*k0n 4 python google-cloud-platform gcloud google-cloud-functions

我有一个如下所示的目录结构:

src/
    main.py
requirements.txt
Run Code Online (Sandbox Code Playgroud)

由于似乎没有任何围绕查找位置的可配置性requirements.txt,因此我已经放弃gcloud functions deploy在外部目录中运行,并且我希望该标志可以给我一些在内部--entry-point定位目标的回旋空间。不幸的是,它似乎只定义了一个方法名称。main.pysrc

main.py那么,除了强制并requirements.txt位于同一目录中之外,还有什么方法可以使其工作吗?

作为参考,我尝试运行的命令和相应的错误消息:

gcloud functions deploy refresh_classes --entry-point main --runtime python37 --trigger-resource send_refresh --trigger-event google.pubsub.topic.publish --timeout 540s

Deploying function (may take a while - up to 2 minutes)...failed.
ERROR: (gcloud.functions.deploy) OperationError: code=3, message=Function failed on loading user code. Error message: File main.py that is expected to define function doesn't exist
Run Code Online (Sandbox Code Playgroud)

Dus*_*ram 6

gcloud单独配置或没有额外的源文件是不可能的。Cloud Functions 需要一个source包含 arequirements.txtmain.py.