在 Google App Engine 中初始化静态数据的数据存储的正确方法是什么?

发布于 2025-01-02 03:21:34 字数 221 浏览 2 评论 0原文

我在 GAE 的应用程序中有一个名为“类别”的模型。

该模型仅包含一个名称及其父类别,网站上线后不会经常更改。

我想知道将这些模型实例放在开头的更好方法是什么?

我现在只知道通过发出 http 请求来在 webapp.RequestHandler 中执行 (category.put())。但我怀疑有一个正确的方法可以做到这一点。

谢谢!

I have a model called "Category" in my app in GAE.

This model simply contains a name and it's parent category, and this won't be changed frequently after the website go online.

I'd like to know what is a better way to put these model instances in the beginning?

I now only know to execute (category.put()) in a webapp.RequestHandler by issuing a http request. But I suspect there is a proper way to do this.

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

卖梦商人 2025-01-09 03:21:34

您可以使用远程 API 在 shell 中连接到您的数据存储区并根据需要添加数据。

或者,如果数量很大,您可以考虑使用批量加载器 - 但是我怀疑远程API会更合适。

You can use the remote API to connect to your datastore in a shell and add data as required.

Or, if it's a huge amount, you could think about using the bulk loader - but I suspect that the remote API will be more suitable.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文