Skip to main content
100%

Gist 8401198

✓ Published0🌍 Public
Aandybak
Last edited Jan 13, 2014
Created on Jan 13, 2014

This example shows a Django management command that clears cached thumbnail data and removes the corresponding thumbnail files from storage. The code uses the sorl-thumbnail library’s default key-value store and storage backend to wipe the cache and delete the `_thumbs_` folder contents. It accepts a `delete` argument to trigger the cleanup, first calling `default.kvstore.clear()` to empty the cached entries, then iterating over items in the thumbnail storage directory and removing each with `rmtree`. The command prints status messages after each step.

AI-generated description

Similar vizzes