【发布时间】:2018-04-06 11:24:35
【问题描述】:
我正在尝试从我的 Raspberry pi 3 使用 firestore 文档中给出的代码连接到我的 firestore 数据库,但示例代码说必须在环境变量中设置数据库的项目 ID,而我不是能做到。。 代码:
from google.cloud import firestore
import google.cloud.exceptions
def quickstart_new_instance():
# [START quickstart_new_instance]
from google.cloud import firestore
# Project ID is determined by the GCLOUD_PROJECT environment variable
db = firestore.Client()
# [END quickstart_new_instance]
return db
【问题讨论】:
-
为什么不能设置环境变量?
-
我不知道该怎么做...你能告诉我如何将 firestore 数据库 ID 添加为 Raspberry pi 环境变量吗??
-
我自己从未这样做过,但这里似乎有一些不错的选择:google.com/search?q=raspberry+pi+set+environment+variable 你尝试过类似的方法吗?
标签: python google-cloud-firestore raspberry-pi3