更快的App Engine开发数据存储替代方案

编程入门 行业动态 更新时间:2024-10-24 12:22:04
本文介绍了更快的App Engine开发数据存储替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 有没有一种方法可以将真正的数据库(SQLite,Mysql,甚至是非关系数据库)用作开发数据存储,而不是提供的内存/文件数据存储。

我看到几个项目,GAE-SQLite(似乎没有工作)和一个关于使用远程api访问生产数据存储的技巧(对于大型数据集仍然很慢)。

解决方案

MongoDB对此非常有用。您需要:

  • MongoDB存根: github/mongodb/mongo-appengine-connector MongoDB: www.mongodb/display/DOCS/Downloads
  • 部分代码将其设置为:

code:

import datastore_mongo_stub os.environ ['APPLICATION_ID'] ='test' datastore = datastore_mongo_stub.DatastoreMongoStub( os.environ [ '','woot','',require_indexes = False) apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3',datastore)

但是,如果您正在寻找更快的开发(就像我一样),数据存储实际上不是单线程Web服务器的问题。 我试图用产卵来代替它,但这太难了。您也可以尝试设置 TyphoonAE ,它将以开放的替代方式模拟appengine堆栈。

请注意,如果您执行其中任何一项操作,您可能会失去当前工具提供的某些确切行为,这意味着如果部署您可以获得结果,没想到。换一种说法;确保你知道你在做什么: - )

Is there a way to use a real database(SQLite, Mysql, or even some non-relational one) as datastore for development, instead of memory/file datastore that is provided.

I saw few projects, GAE-SQLite(did not seem to be working) and one tip about accessing production datastore using remote api (still pretty slow for large datasets).

解决方案

MongoDB works great for that. You will need:

  • The MongoDB stub: github/mongodb/mongo-appengine-connector
  • MongoDB: www.mongodb/display/DOCS/Downloads
  • Some code to set it up like:

code:

import datastore_mongo_stub os.environ['APPLICATION_ID'] = 'test' datastore = datastore_mongo_stub.DatastoreMongoStub( os.environ['APPLICATION_ID'], 'woot', '', require_indexes=False) apiproxy_stub_map.apiproxy.RegisterStub('datastore_v3', datastore)

But if you're looking for truly faster development (like I was) the datastore is actually not the issue as much is the single threaded web server. I tried to replace it with spawning but that was a little too hard. You could also try to set up TyphoonAE which will mimic the appengine stack with open alternatives.

Be aware that if you do any of these, you might lose some of the exact behavior the current tools provide, meaning that if you deploy you could get results you didn't expect. In other words; make sure you know what you're doing :-)

更多推荐

更快的App Engine开发数据存储替代方案

本文发布于:2023-07-30 14:14:14,感谢您对本站的认可!
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:更快   数据存储   方案   Engine   App

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!