Django-rosetta: weird behaviour and polib error

I have recently got a really weird behavior on my production server with django-rosetta: I click on the language and nothing just happens. What?

I've found out, that rosetta uses caching for saving intermediate state of the translation, so if you installed it and didn't configured CACHES in your django settings you'll get this behaviour.

So I tried to set just ROSETTA_STORAGE_CLASS to '', but I got a serialization error:

TypeError: <polib.POEntry object at 0x7f27d96e9b90> is not JSON serializable

Yep. Cookies are just cutted at 4096 bytes, so the data can't be deserialized. Shit.

The solution is to configure django to use memcached:
* install memcached: apt-get install memcached * install libmemcached-dev: apt-get install libmemcached-dev * install python pylibmc: pip install pylibmc * add django caches config in

CACHES = {  
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.PyLibMCCache',
        'LOCATION': '',

So just an advice for me and for you: read the documentation carefully!

comments powered by Disqus