sorl-thumbnail
sorl-thumbnail copied to clipboard
On Django cache image reference mismatch when using manage.py dumpdata
I'm trying to migrate data from staging to local copy of my site.
The images in the media folder are all transferred okay.
Then I use the following command to export my staging site
python manage.py dumpdata --exclude contenttypes > db.json
I then take the db.json file and load it to my local copy of the django site using the following command.
python manage.py loaddata < db.json
Some of the images shows up and some don't, after comparing those image tags src between staging and local. I realized that they don't match up.
For example, an image is referencing a file here on the staging site /media/cache/a0/83/a083042025374b34c59547e857a4d3fa.jpg
becomes this: /media/cache/78/c6/78c6f6982cc063cd9f82939037d990a3.jpg
These are generated by Sorl-thumbnail. Anyone knows why??
Your local key-value store is empty and it regenerates the thumbnails.
If the key for the thumbnail is found in the Key Value Store, the serialized thumbnail information is fetched from it and returned. If the thumbnail key is not found there sorl-thumbnail continues to generate the thumbnail and stores necessary information in the Key Value Store.
More here
Default store is sorl.thumbnail.kvstores.cached_db_kvstore.KVStore
and in case you use some cache like redis you can try to dump your staging redis instance and upload it into your local instance.