文章詳情頁
python2.7 - django 無法連接redis
瀏覽:194日期: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. boot2docker無法啟動2. docker-compose中volumes的問題3. 關(guān)docker hub上有些鏡像的tag被標(biāo)記““This image has vulnerabilities””4. nignx - docker內(nèi)nginx 80端口被占用5. docker安裝后出現(xiàn)Cannot connect to the Docker daemon.6. javascript - mock.js可以存儲數(shù)據(jù)嗎7. java - SSH框架中寫分頁時service層中不能注入分頁類8. golang - 用IDE看docker源碼時的小問題9. docker api 開發(fā)的端口怎么獲?。?/a>10. dockerfile - 為什么docker容器啟動不了?
排行榜

熱門標(biāo)簽
網(wǎng)公網(wǎng)安備