Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Flask and Redis

Tags:

What is best way to interact with Redis in a Flask app? Do you just import Redis and ...

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

or is there an ORM or something I haven't seen yet?

like image 989
Jay Avatar asked Oct 25 '11 21:10

Jay


People also ask

What is Flask and Redis?

Flask-And-Redis provides simple as dead support of Redis database for Flask applications. Extension built around beautiful redis-py library by Andy McCurdy. Works on Python 2.7, 3.4+ BSD licensed.

What are Flask and Redis Python modules used for?

Flask is a good python web microframework which lets you focus only on things you need. There is more focus on the modularity of your code base. Redis is a key-value datastore that can be used as a database.

Can I use Redis with Python?

Redis is easier to use with Python if you have a code library client that bridges from your code to your Redis instace. The following libraries and resources provide more information on handling data in a Redis instance with your Python code. Redis-py is a solid Python client to use with Redis.


2 Answers

There is a lightweight Redis ODM available called Python stdnet:

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.

like image 160
Robert Avatar answered Sep 19 '22 05:09

Robert


Take a look at this extension that provides support for Redis in Flask:

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

like image 25
Gabriel Jordão Avatar answered Sep 19 '22 05:09

Gabriel Jordão