啟動(dòng)redis
1.啟動(dòng)服務(wù):redis-server.exe redis.windows.conf2
.
新開cmd窗口:redis-cli
如果報(bào)錯(cuò)Creating Server TCP listening socket 127.0.0.1:6379: bind: No error
分別輸入:
redis-cli.exe
shutdown
exit
redis-server.exe redis.windows.conf
如果輸入 shutdown 報(bào)錯(cuò):(error) NOAUTH Authentication required.
說明沒有用密碼鏈接:
請(qǐng)輸入: AUTH "password"
查看reids內(nèi)容
kyes *
啟動(dòng)關(guān)閉redis
啟動(dòng)服務(wù):redis-server --service-start
停止服務(wù):redis-server --service-stop
安裝redis相關(guān)的庫(kù)
pip install django-redis
pip install django-redis-sessions
在setting中配置redis緩存session
SESSION_ENGINE = 'redis_sessions.session'
SESSION_REDIS = {
'host': 'localhost',
'port': 6379,
'db': 0,
'password': '123456',
'prefix': 'session',
'socket_timeout': 10}