Can't import datastore in Google App Engine

谁都会走 提交于 2019-12-11 15:26:29

问题


I'm trying to import datastore to my code in GAE like this way,

from google.cloud import datastore

unfortunately I got some error message in stackdriver like this

     from grpc._cython import cygrpc as _cygrpc
ImportError: dynamic module does not define init function (initcygrpc)

or like this

     from google.cloud.datastore_v1 import types 
ImportError: cannot import name types

anyone know the reason or something? thanks in advance

====
env: standard
language: python
runtime: python27


回答1:


That is the generic client datastore library, which is no longer compatible with the standard environment GAE sandbox restrictions. See related GRPC and types import error in App Engine Datastore

From Google App Engine Standard Environment Client Libraries:

Note: For App Engine applications that are written in Python, the Google Datastore DB Client Library is no longer recommended; use the Google Datastore NDB Client Library instead.

So switch to NDB (I find it superior, with more functionality, optimized for GAE and better documented, right in the GAE-specific documentation area).



来源:https://stackoverflow.com/questions/51490175/cant-import-datastore-in-google-app-engine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!