I’ve have a Django app that’s currently hosted up on Amazon’s EC2 service. I have two machines, one with the Django app and the other with my PostgreSQL database. So far it has been rock solid.

Many sources claim I should implement Redis into my stack, but what would be the purpose of implementing Redis with Django and Postgresql? How can I implement Redis in my Django code for example?

How can I use it with PostgreSQL?

These are all the questions I’ve been trying to find answers to so I came here hoping to get answers from the biggest and the best. I really appreciate any answers.

Thank You

Redis is a key-value storage system that operates in RAM memory, it’s like a “light database” and since it works at RAM memory level it’s orders of magnitude faster compared to reading/writing to PostgreSQL or any other traditional Relational Database. Redis is a so-called NoSQL database, like Mongo and many others. It can’t directly replace PostgreSQL, you still want permanent storage, but it works along with Relational Databases as an alternate storage system. You can use Redis if your IO operations start getting expensive and it’s great for quick calculations and key-based queries.

You can include it in your Django/Python project with a wrapper, for example redis-py.

Redis is very simple to install and use, you can check the examples at redis-py. Redis is independent from any Relational Database, that way you can use it for caching, calculating or storing values permanently and/or temporarily. It can help reduce querying to PostgreSQL, in the end you can use it the way you want and take advantage from it to improve your app/architecture.

This similar question can help you Redis with Django