简体   繁体   English

烧瓶和Redis

[英]Flask and Redis

What is best way to interact with Redis in a Flask app? 什么是在Flask应用程序中与Redis交互的最佳方式? Do you just import Redis and ... 你刚刚导入Redis和......

r = redis.Redis()
r.connect()

or is there an ORM or something I haven't seen yet? 或者是否有ORM或我尚未见过的东西?

There is a lightweight Redis ODM available called Python stdnet: 有一个名为Python stdnet的轻量级Redis ODM:

http://lsbardel.github.com/python-stdnet/overview.html http://lsbardel.github.com/python-stdnet/overview.html

Haven't tried it yet but looks good to me. 还没有尝试过,但对我来说看起来不错。 Works with Python 2.6 to 3.3 according to the documentation. 根据文档使用Python 2.6到3.3。

Take a look at this extension that provides support for Redis in Flask: 看一下这个为Flask中的Redis提供支持的扩展:

https://github.com/playpauseandstop/Flask-And-Redis https://github.com/playpauseandstop/Flask-And-Redis

redisca是Redis的一种轻量级ORM,支持Flask。

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

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