Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

A simple Django management command which clears your cache.

Project Description

# django-clear-cache

![I don't always clear my cache...](

I often find myself in situations where I need to fully clear my website's
cache (memcached or whatever). Often times this is required because:

- I'm deploying new code and it will fail to run properly with my currently
cached objects.
- I need to purge invalid (or old) information.
- A *million* other reasons.

The standard way to clear your cache is to open up a management shell, eg:

``` bash
$ python shell
Python 2.7.3 (default, Apr 20 2012, 22:39:59)
[GCC 4.6.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> from django.core.cache import cache
>>> cache.clear()

But obviously, this is annoying as I have to manually log into my production

``django-clear-cache`` makes this process as easy as running a single
management command.

## Install

To install ``django-clear-cache``, simply run ``pip install django-clear-cache``
and you'll get the latest version installed automatically.

Next, modify your Django ```` file, and add ``clear_cache`` to your
``INSTALLED_APPS`` setting:

``` python
# ...

## Usage

To clear your cache, simply run the ``clear_cache`` management command:

``` bash
$ python clear_cache
Your cache has been cleared!

**NOTE**: This will only (obviously) work if you've got a cache configured (eg:
memcached, local memory, etc.). If you have no idea what I'm talking about,
read through the [official Django caching docs](

## Tests

[![Build Status](](

Want to run the tests? No problem:

``` bash
$ git clone git://
$ cd django-clear-cache
$ python develop
$ python test clear_cache
Creating test database for alias 'default'...
.Your cache has been cleared!
Ran 3 tests in 1.007s

Destroying test database for alias 'default'...

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(162.3 kB) Copy SHA256 Hash SHA256
Source None Oct 18, 2012

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting