文章詳情頁
python2.7 - django 無法連接redis
瀏覽:79日期: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. mysql優化 - mysql count(id)查詢速度如何優化?2. angular.js - 不適用其他構建工具,怎么搭建angular1項目3. mysql主從 - 請教下mysql 主動-被動模式的雙主配置 和 主從配置在應用上有什么區別?4. python - django 里自定義的 login 方法,如何使用 login_required()5. 主從備份 - 跪求mysql 高可用主從方案6. java8中,邏輯與 & 符號用在接口類上代表什么意思7. python如何不改動文件的情況下修改文件的 修改日期8. angular.js - angular-ui-bootstrap 報錯無法使用?9. node.js - node_moduls太多了10. python - 關于ACK標志位的TCP端口掃描的疑惑?
排行榜
