[英]Best way to use python library in Firebase project
I found a python package that I want to use within my angular based firebase project (it does some complex analysation of a text file). I found a python package that I want to use within my angular based firebase project (it does some complex analysation of a text file). What is the best way to use it?
使用它的最佳方法是什么? I see the following options:
我看到以下选项:
I'd love to have a "clean and easy" integration in my existing Node.js cloud functions that I use in firebase.我希望在我在 firebase 中使用的现有 Node.js 云函数中进行“干净和简单”的集成。 The firebase CLI can then take over all the URL endpoint handling etc. But I don't see a way to do this.
然后 firebase CLI 可以接管所有 URL 端点处理等。但我看不到这样做的方法。
A kind of better capsulated approach would be to go with 1. or 3. and have a Node.js cloud function calling the endpoint.一种更好的封装方法是对 go 和 1. 或 3. 有一个 Node.js 云 function 调用端点。 With that I would also not have the client code call the endpoint and have better possibilites in configuring it without having to update the client code.
这样我也不会让客户端代码调用端点,并且在配置它时有更好的可能性,而无需更新客户端代码。
Am I missing an approach?我错过了一种方法吗? What would be the best way to do this?
最好的方法是什么?
Use Case: User uploads file, the file and some other values are saved to his account.用例:用户上传文件,文件和其他一些值保存到他的帐户。 The content of the file should be analysed (can be done asynchronously) and the results should be available for the user to be shown.
应该分析文件的内容(可以异步完成)并且结果应该可供用户显示。
I went with option 1 and it is working quite well so far.我选择了选项 1,到目前为止效果很好。 It's very easy to deploy the dockerized flask server on Cloud Run.
在 Cloud Run 上部署 dockerized flask 服务器非常容易。 Also it's possible to control access and authentication from the firebase function to the Cloud Run container with Google's IAM.
此外,还可以使用 Google 的 IAM 控制从 firebase function 到 Cloud Run 容器的访问和身份验证。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.