无法在Google App Engine中导入数据存储

时间:2018-07-24 03:45:20

标签: python python-2.7 google-app-engine google-cloud-platform google-cloud-datastore

我正试图以这种方式将数据存储区导入GAE中的代码,

from google.cloud import datastore

不幸的是,我在堆栈驱动程序中收到了这样的错误消息

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

或类似的

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

有人知道原因吗? 预先感谢

====
环境:标准
语言:python
运行时:python27

1 个答案:

答案 0 :(得分:0)

这是通用客户端数据存储库,该库不再与标准环境GAE沙箱限制兼容。查看相关的GRPC and types import error in App Engine Datastore

来自Google App Engine Standard Environment Client Libraries

  

注意:对于以Python编写的App Engine应用程序,不再建议使用Google Datastore DB Client Library;使用   改为使用Google Datastore NDB客户端库。

因此请切换到NDB(我发现它优越,具有更多功能,针对GAE进行了优化,并且在GAE特定文档区域提供了更好的文档)。