Skip to content

Uses native redis-py url notation connection strings like, Pluggable clients, Pluggable parsers, Highly configurable, and etc.

Notifications You must be signed in to change notification settings

mbrsagor/djangoRedis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

50 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

djangoRedis

Uses native redis-py url notation connection strings like, Pluggable clients, Pluggable parsers, Highly configurable, and etc.

Setup

Prerequisites
  • Python 3.8.5
  • Redis

The following steps will walk you thru installation on a Mac. I think linux should be similar. It's also possible to develop on a Windows machine, but I have not documented the steps. If you've developed django apps on Windows, you should have little problem getting up and running.

git clone https://github.com/mbrsagor/djangoRedis.git
cd djangoRedis
virtualenv venv --python=python3.8
source venv/bin/activate

Then create .env file and paste code from example.env file and add validate information.

After that run the server in development or production environment
Run the development server:
./manage.py makemigrations
./manage.py createsuperuser
./manage.py runserver
Configure as cache backend.
CACHES = {
    "default": {
        "BACKEND": "django_redis.cache.RedisCache",
        "LOCATION": "redis://127.0.0.1:6379/1",
        "OPTIONS": {
            "CLIENT_CLASS": "django_redis.client.DefaultClient",
        }
    }
}
Open Redis CLI: redis-cli

Input:

127.0.0.1:6379> set a 100
OK

Output:

127.0.0.1:6379> get a
"100"
127.0.0.1:6379> 

About

Uses native redis-py url notation connection strings like, Pluggable clients, Pluggable parsers, Highly configurable, and etc.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages