django-vue3-admin-backend/dvadmin/system/management/commands/clear_cache.py
2025-11-02 13:00:04 +08:00

18 lines
539 B
Python

# -*- coding: utf-8 -*-
"""
Clear Django cache to fix UTF-8 decode errors
"""
from django.core.management.base import BaseCommand
from django.core.cache import cache
class Command(BaseCommand):
help = 'Clear Django cache (useful for fixing UTF-8 decode errors)'
def handle(self, *args, **options):
try:
cache.clear()
self.stdout.write(self.style.SUCCESS('Successfully cleared cache!'))
except Exception as e:
self.stdout.write(self.style.ERROR(f'Failed to clear cache: {e}'))