使用 Python 的 Firebase 云函数? [英] Firebase cloud functions using Python?

查看:30
本文介绍了使用 Python 的 Firebase 云函数?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们正在将 GCP 的 Firebase 与 Firestore 结合使用来开发我们正在开发的新移动应用.作为这项工作的一部分,我们需要部署许多云功能,这些功能将充当 Firestore 触发器以进行一些后端处理.

We are using GCP's Firebase with Firestore for a new mobile app we are developing. As part of this effort we need to deploy a number of cloud functions which will act as Firestore triggers for doing some back end processing.

我们的目的是使用 firebase cli 工具将部署封装在 Firebase 内部.但是,当我们尝试使用firebase init 函数"调用为函数启动 Firebase 项目时,只有两种语言选项是Javascript"和Typescript",并且唯一可部署的堆栈似乎是 Node.js.

Our intention is to keep the deploys encapsulated inside of Firebase by using the firebase cli tools. However when we attempt to initiate the Firebase project for functions using the "firebase init functions" call the only two language options are "Javascript" and "Typescript", and the only deployable stack seems to be Node.js.

在之前的 GCP 项目中,我们部署了基于 Python 的云函数(使用 gcloud cli),理想情况下,我们希望继续将 Python 用于我们的 Firebase 云函数.所以我的问题是:

On previous GCP projects we had deployed Python based cloud functions (using the gcloud cli) and ideally we'd like to continue using Python for our Firebase cloud functions. So my questions are:

  1. 是否可以部署基于 Python 的 Firebase 云函数?如果不是:

  1. is it possible to deploy Python-based Firebase cloud functions? If not:

我们是否可以简单地回到使用 gcloud cli 部署基于 Python 的 GCP 云函数,并且仍然让它们作为 Firestore 触发器工作?

can we simply go back to deploying Python-based GCP cloud functions using the gcloud cli and still have them work as Firestore triggers?

谢谢

推荐答案

Firebase CLI 不支持部署用 Python 编写的函数.

The Firebase CLI does not support deploying functions written in python.

您当然可以在 python 中编写 Cloud Firestore 触发器 并部署它们使用 gcloud.

You can certainly write Cloud Firestore triggers in python and deploy them with gcloud.

您可能没有意识到的一件事:无论您如何部署函数,底层的 Cloud Functions 产品都是相同的.Firebase 只是在现有的 Google Cloud Functions 基础架构之上添加工具和 API.真的没有Firebase Cloud Function"这样的东西.只有 Cloud Functions,您可以选择如何编写和部署它们,可以使用 gcloud 或 Firebase CLI.

One thing you might not be aware of: the underlying Cloud Functions product is the same no matter how you deploy your functions. Firebase just adds tools and APIs on top of the existing Google Cloud Functions infrastructure. There is really no such thing as a "Firebase Cloud Function". There is just Cloud Functions, and you have options about how you can write and deploy them, either using gcloud, or the Firebase CLI.

这篇关于使用 Python 的 Firebase 云函数?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆