Added configurable location setting for file based storage

This commit is contained in:
Roberto Rosario
2011-03-07 23:46:09 -04:00
parent 3774a2cb5a
commit 13c4d1e751
3 changed files with 8 additions and 3 deletions

View File

@@ -1,7 +1,9 @@
from django.core.files.storage import FileSystemStorage
from storage.conf.settings import FILESTORAGE_LOCATION
class FileBasedStorage(FileSystemStorage):
def __init__(self, *args, **kwargs):
super(FileBasedStorage, self).__init__(*args, **kwargs)
self.location='document_storage'
self.location=FILESTORAGE_LOCATION

View File

@@ -1,7 +1,8 @@
from django.conf import settings
GRIDFS_HOST = getattr(settings, 'STORAGE_GRIDFS_HOST', 'localhost')
GRIDFS_HOST = getattr(settings, 'STORAGE_GRIDFS_HOST', u'localhost')
GRIDFS_PORT = getattr(settings, 'STORAGE_GRIDFS_PORT', 27017)
GRIDFS_DATABASE_NAME = getattr(settings, 'STORAGE_GRIDFS_DATABASE_NAME', u'document_storage')
FILESTORAGE_LOCATION = getattr(settings, 'STORAGE_FILESTORAGE_LOCATION', u'document_storage')

View File

@@ -202,6 +202,8 @@ LOGIN_EXEMPT_URLS = (
#STORAGE_GRIDFS_HOST = 'localhost' # or list ['host a', 'host b']
#STORAGE_GRIDFS_PORT = 27017
#STORAGE_GRIDFS_DATABASE_NAME = u'document_storage'
# Filebased
#STORAGE_FILESTORAGE_LOCATION = u'document_storage'
# Usage
#DOCUMENTS_PREVIEW_SIZE = '640x480'