已部署 GAE NDB 安装

GAE NDB install deployed

我的 Google App Engine 应用程序使用数据存储 NDB。所以我正在导入:

from google.appengine.ext import ndb

但是当我部署并转到我的应用程序时出现错误:

ModuleNotFoundError: No module named 'google.appengine'

那么如何让 GAE 安装 Google Cloud SDK 的这一部分?

您没有说明您要部署到哪个运行时(Python 2.7 或 3.7),但我猜是 3.7。

google.appengine 模块仅在第一代 Python 2.7 运行时可用。如果您需要使用它,您将需要将您的应用程序部署到此运行时。

来自Using the ndb client library

The ndb client library is not compatible with the Python 3.7 runtime. For more information, see differences between the Python 2.7 and Python 3.7 runtimes on the App Engine standard environment.