Created
January 5, 2014 01:11
-
-
Save victorono/8263015 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
# -*- coding: utf-8 -*- | |
from django.conf import settings | |
from django.core.cache import cache | |
from django.core.management.base import BaseCommand, CommandError | |
class Command(BaseCommand): | |
help = 'Fully clear your site-wide cache.' | |
def handle(self, *args, **kwargs): | |
try: | |
assert settings.CACHES | |
cache.clear() | |
self.stdout.write('Your cache has been cleared!\n') | |
except AttributeError: | |
raise CommandError('You have no cache configured!\n') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment