我在heroku上部署django项目时得到了关注。当django在进行收集静态时尝试压缩静态文件时会发生这种情况。
remote: ERROR MemcachedError: error 3 from memcached_get(:1:django_compressor.mtime.8fb53): (0x25170f0) CONNECTION FAILURE(Connection refused), host: localhost:11211 -> libmemcached/connect.cc:156
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 130, in get
remote: return super(PyLibMCCache, self).get(key, default, version)
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django/core/cache/backends/memcached.py", line 76, in get
remote: val = self._cache.get(key)
remote: ConnectionError: error 3 from memcached_get(:1:django_compressor.mtime.8fb53): (0x25170f0) CONNECTION FAILURE(Connection refused), host: localhost:11211 -> libmemcached/connect.cc:156
remote: ERROR MemcachedError: error 35 from memcached_set: (0x25170f0) SERVER IS MARKED DEAD, host: localhost:11211 -> libmemcached/connect.cc:696
remote: Traceback (most recent call last):
remote: File "/app/.heroku/python/lib/python2.7/site-packages/django_pylibmc/memcached.py", line 140, in set
remote: **COMPRESS_KWARGS)
remote: ServerDead: error 35 from memcached_set: (0x25170f0) SERVER IS MARKED DEAD, host: localhost:11211 -> libmemcached/connect.cc:696
我看到memcached服务器没有运行。问题是如何使用压缩器部署+收集静态而不会出现这些错误。
答案 0 :(得分:0)
CONNECTION FAILURE(Connection refused), host: localhost:11211 -> libmemcached/connect.cc:156
Memcached服务器未运行。
答案 1 :(得分:0)
好的,找到答案here.
将设置更改为以下解决 Heroku + Memacahed + django_compressor 部署问题。
CACHES = {
...
'compressor': {
'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
'LOCATION': 'compressor'
}
}
COMPRESS_CACHE_BACKEND = 'compressor'
答案 2 :(得分:0)
我在raspbian上遇到了同样的错误。原来,我忘了安装memcached。 sudo apt-get install memcached修复了它。希望我帮助过这个人。