18 lines
		
	
	
		
			539 B
		
	
	
	
		
			Python
		
	
	
	
	
	
			
		
		
	
	
			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}'))
 |