文章詳情頁
python2.7 - django 無法連接redis
瀏覽:120日期: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)
求大神指導(dǎo),為何連接不上啊
問題解答
回答1:’LOCARION’ is this a typo?
回答2:’LOCATION’: ’redis://127.0.0.1:6379/4’,
上一條:python - 如何django中用redis緩存服務(wù)器,求詳細(xì)教程。下一條:python2.7 - django-redis使用時,連接后,無法訪問redis中的數(shù)據(jù)?
相關(guān)文章:
1. javascript - vue 怎么渲染自定義組件2. python中如何計算t分布的值?3. javascript - 單個頁面執(zhí)行多個jsonp的ajax請求,如何判斷一個ajax請求執(zhí)行完畢執(zhí)行再另一個?4. 請教各位大佬,瀏覽器點 提交實例為什么沒有反應(yīng)5. javascript - Js 函數(shù)聲明和函數(shù)表達(dá)式6. node.js - nodejs 的sails 框架如何修改ejs的后綴為html7. javascript - 怎么看網(wǎng)站用了什么技術(shù)框架?8. javascript - [MUI 子webview定位]9. javascript - node服務(wù)端渲染的困惑10. mysql - 記得以前在哪里看過一個估算時間的網(wǎng)站
排行榜

熱門標(biāo)簽