PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Sunday, November 13, 2022

[FIXED] How to resolve libmemcached error on Heroku deploy

 November 13, 2022     django, heroku, memcached     No comments   

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)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing