Issue
I get following during deployment of django project on heroku. This happens when django tries to compress static files while doing collect static.
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
I see that memcached server is not running. Question is how to do a deploy + collect static with compressor without getting these errors.
Solution
Ok found answer here.
Changing settings to following solved Heroku + Memacahed + django_compressor deploy problems.
CACHES = { 
    ... 
    'compressor': {
        'BACKEND': 'django.core.cache.backends.locmem.LocMemCache',
        'LOCATION': 'compressor'
    }
}
COMPRESS_CACHE_BACKEND = 'compressor'
                        
                        Answered By - Vladimir Nani Answer Checked By - David Marino (PHPFixing Volunteer)
0 Comments:
Post a Comment
Note: Only a member of this blog may post a comment.