Files
AS_timbres/Sistemas/customStorage.py

18 lines
585 B
Python

from django.core.files.storage import FileSystemStorage
import os
class CustomStorage(FileSystemStorage):
def __init__(self, location):
self.location=location
super(CustomStorage,self).__init__(location=location, base_url=None)
def save(self, name, content):
if self.exists(name):
self.delete(name)
return super()._save(name,content)
BASE_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__)))
download_system_dir = os.path.join(BASE_DIR,'downloadSystems')
custom_stoarge = CustomStorage(location=download_system_dir)