From 80e3ff4a2615c90e731ac572c4f13e8ff8a0b574 Mon Sep 17 00:00:00 2001 From: Alexandre Rossi Date: Thu, 3 Aug 2023 11:10:38 +0200 Subject: [PATCH 1/2] fix STATIC_ROOT not used for dashboard theme search (Fix #2683, #1702) --- webapp/graphite/settings.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/webapp/graphite/settings.py b/webapp/graphite/settings.py index 2cfd9447d..f5ca1846d 100644 --- a/webapp/graphite/settings.py +++ b/webapp/graphite/settings.py @@ -244,10 +244,6 @@ from graphite.app_settings import * # noqa -STATICFILES_DIRS = ( - join(WEBAPP_DIR, 'content'), -) - # Handle renamed timeout settings FIND_TIMEOUT = FIND_TIMEOUT or REMOTE_FIND_TIMEOUT or 3.0 FETCH_TIMEOUT = FETCH_TIMEOUT or REMOTE_FETCH_TIMEOUT or 6.0 @@ -298,6 +294,10 @@ except ImportError: pass +STATICFILES_DIRS = ( + STATIC_ROOT, +) + if DATABASES is None: DATABASES = { 'default': { From f85f9976e9789636f9fcce603d0887080a55415e Mon Sep 17 00:00:00 2001 From: Alexandre Rossi Date: Thu, 24 Aug 2023 13:17:23 +0200 Subject: [PATCH 2/2] fixup! fix STATIC_ROOT not used for dashboard theme search (Fix #2683, #1702) --- webapp/graphite/dashboard/views.py | 5 +++++ webapp/graphite/settings.py | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/webapp/graphite/dashboard/views.py b/webapp/graphite/dashboard/views.py index 80750c7d5..d7a12e9d3 100644 --- a/webapp/graphite/dashboard/views.py +++ b/webapp/graphite/dashboard/views.py @@ -1,4 +1,5 @@ import re +import os import errno from os.path import getmtime @@ -126,6 +127,10 @@ def dashboard(request, name=None): debug = request.GET.get('debug', False) theme = request.GET.get('theme', config.ui_config['theme']) css_file = finders.find('css/dashboard-%s.css' % theme) + if css_file is None: + # Also search in STATIC_ROOT for dist packages + css_file = os.path.isfile(os.path.join(settings.STATIC_ROOT, + 'css/dashboard-%s.css' % theme)) if css_file is None: initialError = "Invalid theme '%s'" % theme theme = config.ui_config['theme'] diff --git a/webapp/graphite/settings.py b/webapp/graphite/settings.py index f5ca1846d..2cfd9447d 100644 --- a/webapp/graphite/settings.py +++ b/webapp/graphite/settings.py @@ -244,6 +244,10 @@ from graphite.app_settings import * # noqa +STATICFILES_DIRS = ( + join(WEBAPP_DIR, 'content'), +) + # Handle renamed timeout settings FIND_TIMEOUT = FIND_TIMEOUT or REMOTE_FIND_TIMEOUT or 3.0 FETCH_TIMEOUT = FETCH_TIMEOUT or REMOTE_FETCH_TIMEOUT or 6.0 @@ -294,10 +298,6 @@ except ImportError: pass -STATICFILES_DIRS = ( - STATIC_ROOT, -) - if DATABASES is None: DATABASES = { 'default': {