Update the storage app to assign itself and icon and register with the app registry
This commit is contained in:
@@ -35,6 +35,7 @@ PILL = 'pill'
|
||||
PLUGIN = 'plugin'
|
||||
RAINBOW = 'rainbow'
|
||||
SCRIPT = 'script'
|
||||
STORAGE = 'storage'
|
||||
TABLE = 'table'
|
||||
TICK = 'tick'
|
||||
USER = 'user'
|
||||
|
||||
@@ -37,6 +37,7 @@ DICTIONARY = {
|
||||
PLUGIN: 'plugin.png',
|
||||
RAINBOW: 'rainbow.png',
|
||||
SCRIPT: 'script.png',
|
||||
STORAGE: 'storage.png',
|
||||
TABLE: 'table.png',
|
||||
TICK: 'tick.png',
|
||||
USER: 'user.png',
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ import os
|
||||
|
||||
from django.core.files.storage import FileSystemStorage
|
||||
|
||||
from storage.conf.settings import FILESTORAGE_LOCATION
|
||||
from storage import FILESTORAGE_LOCATION
|
||||
|
||||
|
||||
class FileBasedStorage(FileSystemStorage):
|
||||
'''Simple wrapper for the stock Django FileSystemStorage class
|
||||
'''
|
||||
"""
|
||||
Simple wrapper for the stock Django FileSystemStorage class
|
||||
"""
|
||||
separator = os.path.sep
|
||||
|
||||
def __init__(self, *args, **kwargs):
|
||||
|
||||
@@ -1,38 +0,0 @@
|
||||
"""Configuration options for the storage app"""
|
||||
import os
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from smart_settings.api import Setting, SettingNamespace
|
||||
|
||||
namespace = SettingNamespace('storage', _(u'Storage'), module='storage.conf.settings')
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name='GRIDFS_HOST',
|
||||
global_name='STORAGE_GRIDFS_HOST',
|
||||
default=u'localhost',
|
||||
)
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name='GRIDFS_PORT',
|
||||
global_name='STORAGE_GRIDFS_PORT',
|
||||
default=27017,
|
||||
)
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name='GRIDFS_DATABASE_NAME',
|
||||
global_name='STORAGE_GRIDFS_DATABASE_NAME',
|
||||
default='document_storage',
|
||||
)
|
||||
|
||||
Setting(
|
||||
namespace=namespace,
|
||||
name='FILESTORAGE_LOCATION',
|
||||
global_name='STORAGE_FILESTORAGE_LOCATION',
|
||||
default=os.path.join(settings.PROJECT_ROOT, u'document_storage'),
|
||||
exists=True
|
||||
)
|
||||
@@ -0,0 +1,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from icons.literals import STORAGE
|
||||
from icons import Icon
|
||||
|
||||
icon_storage = Icon(STORAGE)
|
||||
|
||||
@@ -0,0 +1,39 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
import os
|
||||
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
from django.conf import settings
|
||||
|
||||
from smart_settings import LocalScope
|
||||
|
||||
from .icons import icon_storage
|
||||
|
||||
name = 'storage'
|
||||
label = _(u'Storage')
|
||||
description = _(u'Handles actual storage of files by means of specialized backends.')
|
||||
icon = icon_storage
|
||||
dependencies = ['app_registry']
|
||||
settings = [
|
||||
{
|
||||
'name': 'GRIDFS_HOST',
|
||||
'default': u'localhost',
|
||||
'scopes': [LocalScope()]
|
||||
},
|
||||
{
|
||||
'name': 'GRIDFS_PORT',
|
||||
'default': 27017,
|
||||
'scopes': [LocalScope()]
|
||||
},
|
||||
{
|
||||
'name': 'GRIDFS_DATABASE_NAME',
|
||||
'default': 'document_storage',
|
||||
'scopes': [LocalScope()]
|
||||
},
|
||||
{
|
||||
'name': 'FILESTORAGE_LOCATION',
|
||||
'default': os.path.join(settings.PROJECT_ROOT, u'document_storage'),
|
||||
'exists': True,
|
||||
'scopes': [LocalScope()]
|
||||
},
|
||||
]
|
||||
Reference in New Issue
Block a user