Document image and intermediate file caching now has it's own storage backend.

This commit is contained in:
Roberto Rosario
2015-07-13 01:06:40 -04:00
parent 73c650a5fb
commit 713977ed46
7 changed files with 41 additions and 20 deletions
+18
View File
@@ -0,0 +1,18 @@
from __future__ import unicode_literals
import os
from django.conf import settings
from django.core.files.storage import FileSystemStorage
from .literals import CACHE_PATH
class LocalCacheFileStorage(FileSystemStorage):
"""Simple wrapper for the stock Django FileSystemStorage class"""
def __init__(self, *args, **kwargs):
super(LocalCacheFileStorage, self).__init__(*args, **kwargs)
self.location = os.path.join(settings.MEDIA_ROOT, CACHE_PATH)
if not os.path.exists(os.path.dirname(self.location)):
os.makedirs(os.path.dirname(self.location))