文章詳情頁
python2.7 - django 無法連接redis
瀏覽:123日期:2022-06-25 17:13:09
問題描述
django想用redis做緩存。無法連接redis。
#setting.py中CACHES={ 'default':{'BACKEND': 'django_redis.cache.RedisCache','LOCATION': '127.0.0.1:6379',’OPTIONS’: { #'CLIENT_CLASS': 'redis_cache.client.DefaultClient', 'DB': 0, 'PARSER_CLASS': 'redis.connection.HiredisParser', 'CONNECTION_POOL_CLASS': 'redis.BlockingConnectionPool', 'PICKLE_VERSION': -1 } }}
#views.pydef testCache(request): print cache print dir(cache) mn = cache.get('test2') return HttpResponse(mn)
求大神指導,為何連接不上啊
問題解答
回答1:’LOCARION’ is this a typo?
回答2:’LOCATION’: ’redis://127.0.0.1:6379/4’,
相關文章:
1. javascript - vscode alt+shift+f 格式化js代碼,通不過eslint的代碼風格檢查怎么辦。。。2. javascript - 這不是對象字面量函數嗎?為什么要new初始化?3. javascript - [js]為什么畫布里不出現圖片呢?在線等4. javascript - 如何將一個div始終固定在某個位置;無論屏幕和分辨率怎么變化;div位置始終不變5. javascript - 原生canvas中如何獲取到觸摸事件的canvas內坐標?6. javascript - 求解答:實例對象調用constructor,此時constructor內的this的指向?7. javascript - 有什么比較好的網頁版shell前端組件?8. html - vue項目中用到了elementUI問題9. html5 - 有可以一次性把所有 css外部樣式轉為html標簽內style=" "的方法嗎?10. python - 如何判斷爬蟲已經成功登陸?
排行榜
