简体   繁体   English

Google App Engine开发服务器如何对数据存储存根?

[英]How does Google App Engine Dev Server Stub the Datastore?

GAE has a development server that you can use for imitating the "GAE cloud" in local, non-production environments. GAE拥有一个开发服务器,可用于在本地非生产环境中模拟“ GAE云”。 According to the docs, it mimics all Service API calls. 根据文档,它模仿所有Service API调用。

I'm curious as to how it works with respect to the NoSQL Datastore API. 我对NoSQL Datastore API的工作方式感到好奇。 Is there a way to configure your GAE dev server to work with a local database (so you can feed it dummy data that is meaningful to your test cases)? 有没有一种方法可以配置您的GAE开发服务器以使其与本地数据库一起使用(以便您可以向其提供对测试用例有意义的虚拟数据)? If so how does this work as it is not documented anywhere that I can tell! 如果是这样的话,这是如何进行的,因为我无法告诉任何地方! Thanks in advance! 提前致谢!

The development server uses a in-memory key-value store to simulate datastore locally. 开发服务器使用内存中的键值存储在本地模拟数据存储。 You can use the --use_sqlite flag to make it work with a local sqlite3 db file instead. 您可以使用--use_sqlite标志来使其与本地sqlite3 db文件配合使用。

Local unit tests with datastore are documented here 此处记录带有数据存储区的本地单元测试

您也可以使用--datastore_path标志将数据存储到文件中,而不是内存中。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM