Introducing Django ClearCache 🤠🧹💰 - allows to clear cache via admin UI or command line

Jan 22, 2020 · by Tim Kamanin

I've been working with the Django cache recently. And while Django has exceptional caching capabilities, I was surprised to find out that it doesn't provide a simple way to manually clear a cache.

I checked online and found a couple of clear cache packages for Django, but all of them were too old, and you could only clear cache via the command line.

At the same time, I wanted a package to do the following:

  1. give me the ability to choose a cache I want to clear (Django can have as many cache names/backends as you wish);
  2. allow me to clear cache via admin UI by a click on a button;
  3. allow me to clear cache via manage.py command so I could integrate it into CI/CD pipeline.

... and a few hours later, I came up with the Django ClearCache package that you can now install and use:

bash
pip install django-clearcache

It checks all the points above, here's how the UI part looks:

Django ClearCache Admin UI demo

Find the repo here: https://github.com/timonweb/django-clearcache and don't forget to star it if you like it, and to follow me on twitter @timonweb for more Django and JavaScript stuff!

Want to get more 🔥 tips like this one?

Subscribe to get notified about new dev tutorials