【发布时间】:2018-04-18 03:10:48
【问题描述】:
我在 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.
这是我正在使用的示例代码。
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()))
我的应用程序已在应用引擎上启用:
当我转到 DataStore 选项卡时,我被指向 FireStore。
我错过了这里的任何步骤吗?
找到这个link,但它只是建议在应用引擎上启用该应用,我已经这样做了。
【问题讨论】:
标签: python-3.x google-app-engine google-cloud-platform google-cloud-firestore