Fix plugin paths when app media is set to a different folder

pull/994/head
Piero Toffanin 2021-06-08 10:31:47 -04:00
rodzic 23eafb1e8a
commit de17943440
2 zmienionych plików z 23 dodań i 25 usunięć

Wyświetl plik

@ -131,10 +131,7 @@ class PluginBase(ABC):
:param path: unix-style path
:return: path used to reference Django templates for a plugin
"""
if self.is_persistent():
return "plugins/{}/templates/{}".format(self.get_name(), path)
else:
return "app/media/plugins/{}/templates/{}".format(self.get_name(), path)
return "plugins/{}/templates/{}".format(self.get_name(), path)
def path_exists(self, path):
return os.path.exists(self.get_path(path))

Wyświetl plik

@ -121,27 +121,6 @@ MIDDLEWARE = [
ROOT_URLCONF = 'webodm.urls'
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'app', 'templates'),
os.path.join(BASE_DIR, 'app', 'templates', 'app'),
BASE_DIR
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'app.contexts.settings.load',
],
},
},
]
WSGI_APPLICATION = 'webodm.wsgi.application'
@ -290,6 +269,28 @@ MEDIA_TMP = os.path.join(MEDIA_ROOT, 'tmp')
FILE_UPLOAD_TEMP_DIR = MEDIA_TMP
TEMPLATES = [
{
'BACKEND': 'django.template.backends.django.DjangoTemplates',
'DIRS': [
os.path.join(BASE_DIR, 'app', 'templates'),
os.path.join(BASE_DIR, 'app', 'templates', 'app'),
BASE_DIR,
MEDIA_ROOT,
],
'APP_DIRS': True,
'OPTIONS': {
'context_processors': [
'django.template.context_processors.debug',
'django.template.context_processors.request',
'django.contrib.auth.context_processors.auth',
'django.contrib.messages.context_processors.messages',
'app.contexts.settings.load',
],
},
},
]
# Store flash messages in cookies
MESSAGE_STORAGE = 'django.contrib.messages.storage.cookie.CookieStorage'
MESSAGE_TAGS = {