简体   繁体   中英

Django 1.9 + sorl-thumbnail + memcached

I'm configuring sorl-thumbnail and when memcached is running locally I get this error:

OperationalError at /groups/1/
no such table: thumbnail_kvstore

When memcached isn't running (obviously doesn't work):

TypeError at /groups/1/
a bytes-like object is required, not 'str'

What's wrong with my configuration? Why is it saying there's no thumbnail_kvstore table? Here are my settings variables. I tried setting the THUMBNAIL_KVSTORE setting but it didn't change anything:

CACHES = {
    'default': {
        'BACKEND': 'django.core.cache.backends.memcached.MemcachedCache',
        'LOCATION': '127.0.0.1:11211',
    }
}
THUMBNAIL_DEBUG = True
THUMBNAIL_FORMAT = 'PNG'

If just

manage.py makemigrations 

doesn't create any migrations, try

manage.py makemigrations thumbnail 
manage.py migrate

This will create migrations for thumbnail and then migrate them. It works for me. I am using Django 1.9 and sorl.thumbnail 12.3.

I had to force upgrade sorl-thumbnail:

pip install --pre --upgrade sorl-thumbnail

https://github.com/mariocesar/sorl-thumbnail/issues/384

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM