我看到几个项目,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:
- 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开发数据存储替代方案
发布评论