项目不存在或不包含活动的 Cloud DataStore

was*_*898 5 google-app-engine python-3.x google-cloud-platform google-cloud-firestore

我在 Google Cloud Platform 上有一个使用 FireStore 作为数据库的应用程序。

尝试在 FireStore 上插入记录时出现此错误。

google.api_core.exceptions.NotFound: 404 The project "book-shop-c73ec" does not
exist or it does not contain an active Cloud Datastore database. Please visit ht
tp://console.cloud.google.com to create a project or https://console.cloud.googl
e.com/datastore/setup?project="book-shop-c73ec" to add a Cloud Datastore databas
e. Note that Cloud Datastore always has an associated App Engine app and this ap
p must not be disabled.
Run Code Online (Sandbox Code Playgroud)

这是我正在使用的示例代码。

from google.cloud import firestore

# Add a new document
db = firestore.Client()
doc_ref = db.collection(u'users').document(u'alovelace')
doc_ref.set({
    u'first': u'Ada',
    u'last': u'Lovelace',
    u'born': 1815
})

# Then query for documents
users_ref = db.collection(u'users')
docs = users_ref.get()

for doc in docs:
    print(u'{} => {}'.format(doc.id, doc.to_dict()))
Run Code Online (Sandbox Code Playgroud)

我的应用程序已在应用引擎上启用:

在此处输入图片说明

当我转到 DataStore 选项卡时,我指向 FireStore。

在此处输入图片说明

我错过了这里的任何一步吗?

找到了这个链接,但它只是建议在应用引擎上启用应用程序,我已经这样做了。

was*_*898 2

这只是我在 Windows 上的环境变量的错误。

我已将其设置为

set GCLOUD_PROJECT="project-name"
Run Code Online (Sandbox Code Playgroud)

反而

set GCLOUD_PROJECT=project-name
Run Code Online (Sandbox Code Playgroud)