我正试图在Django应用程序中使用Memcache,但我的配置中似乎缺少了一些东西。任何帮助都将不胜感激,谢谢!
$ python manage.py shell
Python 2.7.1 (r271:86832, Jul 31 2011, 19:30:53)
[GCC 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2335.15.00)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
(InteractiveConsole)
>>> from django.core.cache import cache
>>> cache.set('my_key', 'hello, world!', 30)
>>> print cache.get('my_key')
None
>>>
Settings.py
CACHES = {
'default': {
'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
'LOCATION': '127.0.0.1:11211',
}
}
已安装的API:
$ pypm install python-memcached
$ brew install memcached
$ brew install libmemcached
发布于 2013-08-22 08:44:38
我想我的配置有一些问题,所以我再次使用MacPorts安装了Memcache。
$ sudo port install memcached
然后我运行了Memcache,它起作用了
$ memcached -vv
这些指令已经在MacOSX10.7.5 (Lion)上进行了测试。
有关更多信息,访问本网站
发布于 2014-05-25 23:29:19
谢谢,我只想说它也适用于我的ubuntu机器.
要安装在ubuntu中:
$sudo apt-get install memcached
https://stackoverflow.com/questions/18384197
复制相似问题