更快的App Engine开发数据存储替代方案 [英] Faster App Engine Development Datastore Alternative

查看:118
本文介绍了更快的App Engine开发数据存储替代方案的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法可以将真正的数据库(SQLite,Mysql,甚至是非关系数据库)用作开发数据存储,而不是提供的内存/文件数据存储。



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

解决方案

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



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:

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开发数据存储替代方案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆