From 266f593d2d00a0c35bf7af67a0be1326505b40be Mon Sep 17 00:00:00 2001 From: Matjaz Gregoric Date: Thu, 14 Jan 2016 09:00:17 +0100 Subject: [PATCH] Remove ThemingAware storage mixins and ComprehensiveThemeFinder. Collectstatic failed in production when comprehensive theme contained custom css files. This patch fixes that problem by removing ComprehensiveThemeFinder from STATICFILES_FINDERS and ComprehensiveThemingAware mixin from STATICFILES_STORAGE. Comprehensive theme static dirs are added to the top of the STATICFILES_DIRS entry, which means that the default django FilesystemFinder will find theme static files, and since the theme folder is at the top of STATICFILES_DIRS, theme files will take precedence over default LMS/CMS static files. This change means that theme static file URLs are no longer prefixed with themes//, but since we currently only support one comprehensive theme at a time, that shouldn't be a problem. If/when we want to make the choice of a theme dynamic per-request (microsites?), we will have to bring custom theme finders and storage mixins back, but for now, we don't need them. --- cms/envs/common.py | 1 - cms/envs/devstack.py | 1 - lms/envs/common.py | 1 - lms/envs/devstack.py | 1 - openedx/core/storage.py | 3 --- 5 files changed, 7 deletions(-) diff --git a/cms/envs/common.py b/cms/envs/common.py index d6ce7cf47b..d00854b441 100644 --- a/cms/envs/common.py +++ b/cms/envs/common.py @@ -484,7 +484,6 @@ STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage' # List of finder classes that know how to find static files in various locations. # Note: the pipeline finder is included to be able to discover optimized files STATICFILES_FINDERS = [ - 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'pipeline.finders.PipelineFinder', diff --git a/cms/envs/devstack.py b/cms/envs/devstack.py index 044a997cea..64d417be63 100644 --- a/cms/envs/devstack.py +++ b/cms/envs/devstack.py @@ -41,7 +41,6 @@ STATICFILES_STORAGE = 'openedx.core.storage.DevelopmentStorage' # Revert to the default set of finders as we don't want the production pipeline STATICFILES_FINDERS = [ - 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ] diff --git a/lms/envs/common.py b/lms/envs/common.py index 68fcc3e6c7..8bcef48804 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -1154,7 +1154,6 @@ STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage' # List of finder classes that know how to find static files in various locations. # Note: the pipeline finder is included to be able to discover optimized files STATICFILES_FINDERS = [ - 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', 'pipeline.finders.PipelineFinder', diff --git a/lms/envs/devstack.py b/lms/envs/devstack.py index 3445bf21a5..a0ff8932ce 100644 --- a/lms/envs/devstack.py +++ b/lms/envs/devstack.py @@ -99,7 +99,6 @@ STATICFILES_STORAGE = 'openedx.core.storage.DevelopmentStorage' # Revert to the default set of finders as we don't want the production pipeline STATICFILES_FINDERS = [ - 'openedx.core.djangoapps.theming.finders.ComprehensiveThemeFinder', 'django.contrib.staticfiles.finders.FileSystemFinder', 'django.contrib.staticfiles.finders.AppDirectoriesFinder', ] diff --git a/openedx/core/storage.py b/openedx/core/storage.py index 6607b27c0c..ff17694707 100644 --- a/openedx/core/storage.py +++ b/openedx/core/storage.py @@ -4,11 +4,9 @@ Django storage backends for Open edX. from django.contrib.staticfiles.storage import StaticFilesStorage, CachedFilesMixin from pipeline.storage import PipelineMixin, NonPackagingMixin from require.storage import OptimizedFilesMixin -from openedx.core.djangoapps.theming.storage import ComprehensiveThemingAwareMixin class ProductionStorage( - ComprehensiveThemingAwareMixin, OptimizedFilesMixin, PipelineMixin, CachedFilesMixin, @@ -22,7 +20,6 @@ class ProductionStorage( class DevelopmentStorage( - ComprehensiveThemingAwareMixin, NonPackagingMixin, PipelineMixin, StaticFilesStorage