简体   繁体   English

尝试将python脚本部署到暂存区

[英]Trying to deploy a python script to staging bucket

For use with dialogflow I've been deploying index.js javascript files to google cloud sdk staging bucket using: 为了与dialogflow结合使用,我一直在使用以下方法将index.js javascript文件部署到google cloud sdk暂存区:

gcloud beta functions deploy projName --staging-bucket projName.appspot.com 
--trigger-http

Today I tried to switch from javascript to python because I know it a little better. 今天,我尝试从javascript切换到python,因为我知道它更好一些。

I hoped it would be as simple as replacing index.js with index.py but the deployment still searches for index.js. 我希望它就像将index.js替换为index.py一样简单,但是部署仍会搜索index.js。

The error message I get is message=Function load error: File index.js or junction.js that is expected to define function does not exist in the root directory. 我收到的错误消息是message = Function load error:根目录中不存在预期用于定义功能的文件index.js或junction.js。

I got the impression it would be a simple switch because I'm using the webhook script provided by dialogflow themselves on here: https://github.com/dialogflow/fulfillment-webhook-weather-python 我觉得这将是一个简单的切换,因为我在这里使用了dialogflow本身提供的webhook脚本: https : //github.com/dialogflow/fulfillment-webhook-weather-python

Any ideas how to solve this issue? 任何想法如何解决这个问题?

You are trying to deploy a cloud function, but as far as I know, you can't write Google cloud functions in Python. 您正在尝试部署云功能,但据我所知,您无法用Python编写Google云功能。 Javascript is the only supported language at this time. Javascript是目前唯一受支持的语言。

See, for example, https://cloud.google.com/functions/docs/writing/ 参见例如https://cloud.google.com/functions/docs/writing/

If you want to deploy Python code, you are going to need some other method; 如果要部署Python代码,则将需要其他方法。 maybe AppEngine, which is what it looks like the code you linked to was using. 也许是AppEngine,这就是您所链接的代码所使用的样子。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM