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
|
||||
)
|
||||
7
apps/storage/icons.py
Normal file
7
apps/storage/icons.py
Normal file
@@ -0,0 +1,7 @@
|
||||
from __future__ import absolute_import
|
||||
|
||||
from icons.literals import STORAGE
|
||||
from icons import Icon
|
||||
|
||||
icon_storage = Icon(STORAGE)
|
||||
|
||||
39
apps/storage/registry.py
Normal file
39
apps/storage/registry.py
Normal file
@@ -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()]
|
||||
},
|
||||
]
|
||||
70
settings.py
70
settings.py
@@ -30,7 +30,7 @@ DATABASES = {
|
||||
'default': {
|
||||
'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
|
||||
'NAME': os.path.join(PROJECT_ROOT, '%s.sqlite' % PROJECT_NAME), # Or path to database file if using sqlite3.
|
||||
'USER': '', # Not used with sqlite3.
|
||||
'GROUP': '', # Not used with sqlite3.
|
||||
'PASSWORD': '', # Not used with sqlite3.
|
||||
'HOST': '', # Set to empty string for localhost. Not used with sqlite3.
|
||||
'PORT': '', # Set to empty string for default. Not used with sqlite3.
|
||||
@@ -104,15 +104,15 @@ TEMPLATE_LOADERS = (
|
||||
)
|
||||
|
||||
MIDDLEWARE_CLASSES = (
|
||||
'common.middleware.strip_spaces_widdleware.SpacelessMiddleware',
|
||||
#'common.middleware.strip_spaces_widdleware.SpacelessMiddleware',
|
||||
'django.middleware.common.CommonMiddleware',
|
||||
'django.contrib.sessions.middleware.SessionMiddleware',
|
||||
'django.middleware.locale.LocaleMiddleware',
|
||||
'django.middleware.csrf.CsrfViewMiddleware',
|
||||
'django.contrib.auth.middleware.AuthenticationMiddleware',
|
||||
'django.contrib.messages.middleware.MessageMiddleware',
|
||||
'common.middleware.login_required_middleware.LoginRequiredMiddleware',
|
||||
'permissions.middleware.permission_denied_middleware.PermissionDeniedMiddleware',
|
||||
#'common.middleware.login_required_middleware.LoginRequiredMiddleware',
|
||||
#'permissions.middleware.permission_denied_middleware.PermissionDeniedMiddleware',
|
||||
'pagination.middleware.PaginationMiddleware',
|
||||
)
|
||||
|
||||
@@ -147,55 +147,55 @@ INSTALLED_APPS = (
|
||||
'compressor',
|
||||
'djangorestframework',
|
||||
# Base generic
|
||||
'app_registry',
|
||||
'permissions',
|
||||
'acls',
|
||||
'navigation',
|
||||
'icons',
|
||||
'project_setup',
|
||||
'project_tools',
|
||||
'smart_settings',
|
||||
'navigation',
|
||||
'lock_manager',
|
||||
'app_registry',
|
||||
'smart_settings',
|
||||
'web_theme',
|
||||
'common',
|
||||
# pagination needs to go after web_theme so that the pagination template is found
|
||||
'pagination',
|
||||
'common',
|
||||
'django_gpg',
|
||||
'acls',
|
||||
#'django_gpg',
|
||||
'converter',
|
||||
'trash',
|
||||
#'trash',
|
||||
'user_management',
|
||||
'mimetype',
|
||||
'clustering',
|
||||
'scheduler',
|
||||
'job_processor',
|
||||
'icons',
|
||||
#'mimetype',
|
||||
#'clustering',
|
||||
#'scheduler',
|
||||
#'job_processor',
|
||||
# Mayan EDMS
|
||||
'diagnostics',
|
||||
'maintenance',
|
||||
'storage',
|
||||
'documents',
|
||||
'tags',
|
||||
'folders',
|
||||
'dynamic_search',
|
||||
'document_comments',
|
||||
'document_signatures',
|
||||
'linking',
|
||||
'metadata',
|
||||
'ocr',
|
||||
#'documents',
|
||||
#'tags',
|
||||
#'folders',
|
||||
#'dynamic_search',
|
||||
#'document_comments',
|
||||
#'document_signatures',
|
||||
#'linking',
|
||||
#'metadata',
|
||||
#'ocr',
|
||||
'main',
|
||||
'installation',
|
||||
'document_indexing',
|
||||
'sources',
|
||||
'mailer',
|
||||
'document_acls',
|
||||
#'installation',
|
||||
#'document_indexing',
|
||||
#'sources',
|
||||
#'mailer',
|
||||
#'document_acls',
|
||||
'history',
|
||||
'workflows',
|
||||
'checkouts',
|
||||
'rest_api',
|
||||
'bootstrap',
|
||||
#'workflows',
|
||||
#'checkouts',
|
||||
#'rest_api',
|
||||
#'bootstrap',
|
||||
'statistics',
|
||||
|
||||
# Has to be last so the other apps can register it's signals
|
||||
'signaler',
|
||||
#'signaler',
|
||||
)
|
||||
|
||||
TEMPLATE_CONTEXT_PROCESSORS = (
|
||||
|
||||
60
urls.py
60
urls.py
@@ -5,45 +5,45 @@ from django.conf import settings
|
||||
admin.autodiscover()
|
||||
|
||||
urlpatterns = patterns('',
|
||||
(r'^', include('common.urls')),
|
||||
(r'^', include('main.urls')),
|
||||
(r'^documents/', include('documents.urls')),
|
||||
(r'^folders/', include('folders.urls')),
|
||||
(r'^search/', include('dynamic_search.urls')),
|
||||
(r'^ocr/', include('ocr.urls')),
|
||||
(r'^apps/', include('app_registry.urls')),#, namespace='user_blogs')),
|
||||
(r'^common/', include('common.urls')),
|
||||
(r'^permissions/', include('permissions.urls')),
|
||||
(r'^tags/', include('tags.urls')),
|
||||
(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
(r'^admin/', include(admin.site.urls)),
|
||||
(r'^comments/', include('document_comments.urls')),
|
||||
(r'^user_management/', include('user_management.urls')),
|
||||
(r'^setup/', include('project_setup.urls')),
|
||||
(r'^tools/', include('project_tools.urls')),
|
||||
(r'^settings/', include('smart_settings.urls')),
|
||||
(r'^metadata/', include('metadata.urls')),
|
||||
(r'^linking/', include('linking.urls')),
|
||||
(r'^document_indexing/', include('document_indexing.urls')),
|
||||
#(r'^documents/', include('documents.urls')),
|
||||
#(r'^folders/', include('folders.urls')),
|
||||
#(r'^search/', include('dynamic_search.urls')),
|
||||
#(r'^ocr/', include('ocr.urls')),
|
||||
#(r'^tags/', include('tags.urls')),
|
||||
#(r'^comments/', include('document_comments.urls')),
|
||||
(r'^user_management/', include('user_management.urls')),
|
||||
#(r'^metadata/', include('metadata.urls')),
|
||||
#(r'^linking/', include('linking.urls')),
|
||||
#(r'^document_indexing/', include('document_indexing.urls')),
|
||||
(r'^history/', include('history.urls')),
|
||||
(r'^converter/', include('converter.urls')),
|
||||
(r'^sources/', include('sources.urls')),
|
||||
(r'^project_setup/', include('project_setup.urls')),
|
||||
(r'^project_tools/', include('project_tools.urls')),
|
||||
#(r'^sources/', include('sources.urls')),
|
||||
(r'^acls/', include('acls.urls')),
|
||||
(r'^document_acls/', include('document_acls.urls')),
|
||||
(r'^api/', include('rest_api.urls')),
|
||||
(r'^gpg/', include('django_gpg.urls')),
|
||||
(r'^documents/signatures/', include('document_signatures.urls')),
|
||||
(r'^mailer/', include('mailer.urls')),
|
||||
(r'^workflows/', include('workflows.urls')),
|
||||
(r'^checkouts/', include('checkouts.urls')),
|
||||
(r'^installation/', include('installation.urls')),
|
||||
(r'^scheduler/', include('scheduler.urls')),
|
||||
(r'^job_processing/', include('job_processor.urls')),
|
||||
(r'^bootstrap/', include('bootstrap.urls')),
|
||||
#(r'^document_acls/', include('document_acls.urls')),
|
||||
#(r'^api/', include('rest_api.urls')),
|
||||
#(r'^gpg/', include('django_gpg.urls')),
|
||||
#(r'^documents/signatures/', include('document_signatures.urls')),
|
||||
#(r'^mailer/', include('mailer.urls')),
|
||||
#(r'^workflows/', include('workflows.urls')),
|
||||
#(r'^checkouts/', include('checkouts.urls')),
|
||||
#(r'^installation/', include('installation.urls')),
|
||||
#(r'^scheduler/', include('scheduler.urls')),
|
||||
#(r'^job_processing/', include('job_processor.urls')),
|
||||
#(r'^bootstrap/', include('bootstrap.urls')),
|
||||
(r'^diagnostics/', include('diagnostics.urls')),
|
||||
(r'^maintenance/', include('maintenance.urls')),
|
||||
(r'^statistics/', include('statistics.urls')),
|
||||
(r'^clustering/', include('clustering.urls')),
|
||||
(r'^trash/', include('trash.urls')),
|
||||
(r'^apps/', include('app_registry.urls')),#, namespace='user_blogs')),
|
||||
#(r'^clustering/', include('clustering.urls')),
|
||||
#(r'^trash/', include('trash.urls')),
|
||||
#(r'^admin/doc/', include('django.contrib.admindocs.urls')),
|
||||
#(r'^admin/', include(admin.site.urls)),
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user