From 59a4ffc4ffa03750003a42270907345b5f21fdba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9DNyymix=E2=80=9D?= Date: Thu, 24 Apr 2025 23:32:50 +0300 Subject: [PATCH] Add clear cache management command --- gallery/management/commands/clear_cache.py | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 gallery/management/commands/clear_cache.py diff --git a/gallery/management/commands/clear_cache.py b/gallery/management/commands/clear_cache.py new file mode 100644 index 0000000..f7de669 --- /dev/null +++ b/gallery/management/commands/clear_cache.py @@ -0,0 +1,10 @@ +from django.core.cache import cache +from django.core.management.base import BaseCommand + + +class Command(BaseCommand): + help = "Clears the entire Django cache." + + def handle(self, *args, **options): + cache.clear() + self.stdout.write(self.style.SUCCESS("Cache cleared successfully.")) \ No newline at end of file