customStorage manager in Sistemas app and zip views to upload the zip
This commit is contained in:
18
Sistemas/customStorage.py
Normal file
18
Sistemas/customStorage.py
Normal file
@@ -0,0 +1,18 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user