Skip to content

Commit da5eccd

Browse files
authored
refactor: update static storage configuration for Django 5.2+ compatibility (#96)
* refactor: update static storage configuration for Django 5.2+ compatibility * fix: catch TypeError in common settings * chore: update and drop django42 support
1 parent 9f33af4 commit da5eccd

18 files changed

Lines changed: 111 additions & 88 deletions

File tree

.github/workflows/integration-test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
fail-fast: false
1010
matrix:
11-
tutor_version: ['<21.0.0', '<22.0.0', 'main']
11+
tutor_version: ['<22.0.0', 'main']
1212
steps:
1313
- name: Run Integration Tests
1414
uses: eduNEXT/integration-test-in-tutor@v0.1.3

.github/workflows/tests.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,7 @@ jobs:
1212
max-parallel: 2
1313
matrix:
1414
python-version: ["3.11", "3.12"]
15-
django: ["42", "52"]
16-
exclude:
17-
- python-version: "3.12"
18-
django: "42"
15+
django: ["52"]
1916

2017
steps:
2118
- name: Checkout

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [v10.0.0](https://github.com/eduNEXT/eox-theming/compare/v9.3.1...v10.0.0) - (2026-02-11)
9+
10+
#### ⚠ BREAKING CHANGES
11+
12+
- **Dropped Support for Django 4.2**: Removed support for Django 4.2 in this plugin. As a result, we have also dropped support for Open edX releases from Palm up to and including Teak, which rely on Django 4.2. Future versions of this plugin may not be compatible with these Open edX releases.
13+
814
## [v9.3.1](https://github.com/eduNEXT/eox-theming/compare/v9.3.0...v9.3.1) - (2026-01-20)
915

1016
### Changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,6 @@ quality: clean ## check coding style with pycodestyle and pylint
5656
test-python: clean ## Run test suite.
5757
$(TOX) pip install -r requirements/test.txt --exists-action w
5858
$(TOX) coverage run --source="." -m pytest ./eox_theming --ignore-glob='**/integration/*'
59-
$(TOX) coverage report -m --fail-under=74
59+
$(TOX) coverage report -m --fail-under=73
6060

6161
run-tests: test-python quality

README.rst

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -23,33 +23,33 @@ The plugin conducts a hierarchical search for the requested template. It begins
2323
Compatibility Notes
2424
===================
2525

26-
+------------------+---------------+
27-
| Open edX Release | Version |
28-
+==================+===============+
29-
| Juniper | >= 1.0 < 2.0 |
30-
+------------------+---------------+
31-
| Koa | >= 2.0 < 3.0 |
32-
+------------------+---------------+
33-
| Lilac | >= 2.0 < 8.0 |
34-
+------------------+---------------+
35-
| Maple | >= 3.0 < 8.0 |
36-
+------------------+---------------+
37-
| Nutmeg | >= 4.0 < 8.0 |
38-
+------------------+---------------+
39-
| Olive | >= 5.0 < 8.0 |
40-
+------------------+---------------+
41-
| Palm | >= 6.0 < 8.0 |
42-
+------------------+---------------+
43-
| Quince | >= 7.0 < 9.0 |
44-
+------------------+---------------+
45-
| Redwood | >= 7.2.0 |
46-
+------------------+---------------+
47-
| Sumac | >= 8.1.0 |
48-
+------------------+---------------+
49-
| Teak | >= 9.0.0 |
50-
+------------------+---------------+
51-
| Ulmo | >= 9.3.0 |
52-
+------------------+---------------+
26+
+------------------+-----------------+
27+
| Open edX Release | Version |
28+
+==================+=================+
29+
| Juniper | >= 1.0 < 2.0 |
30+
+------------------+-----------------+
31+
| Koa | >= 2.0 < 3.0 |
32+
+------------------+-----------------+
33+
| Lilac | >= 2.0 < 8.0 |
34+
+------------------+-----------------+
35+
| Maple | >= 3.0 < 8.0 |
36+
+------------------+-----------------+
37+
| Nutmeg | >= 4.0 < 8.0 |
38+
+------------------+-----------------+
39+
| Olive | >= 5.0 < 8.0 |
40+
+------------------+-----------------+
41+
| Palm | >= 6.0 < 8.0 |
42+
+------------------+-----------------+
43+
| Quince | >= 7.0 < 9.0 |
44+
+------------------+-----------------+
45+
| Redwood | >= 7.2.0 < 10.0 |
46+
+------------------+-----------------+
47+
| Sumac | >= 8.1.0 < 10.0 |
48+
+------------------+-----------------+
49+
| Teak | >= 9.0.0 < 10.0 |
50+
+------------------+-----------------+
51+
| Ulmo | >= 10.0.0 |
52+
+------------------+-----------------+
5353

5454
The plugin is configured for the latest release (Teak). If you need compatibility for previous releases, go to the README of the relevant version tag and if it is necessary you can change the configuration in ``eox_theming/settings/common.py``.
5555

eox_theming/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44

55
from __future__ import unicode_literals
66

7-
__version__ = '9.3.1'
7+
__version__ = '10.0.0'

eox_theming/settings/common.py

Lines changed: 18 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,10 @@
1010

1111
from __future__ import unicode_literals
1212

13+
import logging
14+
15+
logger = logging.getLogger(__name__)
16+
1317
# Quick-start development settings - unsuitable for production
1418
# See https://docs.djangoproject.com/en/1.11/howto/deployment/checklist/
1519

@@ -50,9 +54,8 @@ def plugin_settings(settings):
5054

5155
try:
5256
settings.TEMPLATES[0]['OPTIONS']['loaders'][0] = 'eox_theming.theming.template_loaders.EoxThemeTemplateLoader'
53-
except AttributeError:
54-
# We must find a way to register this error
55-
pass
57+
except (AttributeError, TypeError):
58+
logger.error("Couldn't set template loaders. Check your settings.")
5659

5760
try:
5861
eox_configuration_path = 'eox_theming.theming.context_processor.eox_configuration'
@@ -62,18 +65,24 @@ def plugin_settings(settings):
6265
settings.TEMPLATES[1]['OPTIONS']['context_processors'].append(eox_configuration_path)
6366

6467
settings.DEFAULT_TEMPLATE_ENGINE = settings.TEMPLATES[0]
65-
except AttributeError:
66-
# We must find a way to register this error
67-
pass
68+
except (AttributeError, TypeError):
69+
logger.error("Couldn't set default template engine. Check your settings.")
6870

6971
try:
7072
settings.MIDDLEWARE = [
7173
'eox_theming.theming.middleware.EoxThemeMiddleware' if 'CurrentSiteThemeMiddleware' in x else x
7274
for x in settings.MIDDLEWARE
7375
]
74-
except AttributeError:
75-
# We must find a way to register this error.
76-
pass
76+
except (AttributeError, TypeError):
77+
logger.error("Couldn't set MIDDLEWARE. Check your settings.")
78+
79+
if hasattr(settings, 'STORAGES'):
80+
new_storages = dict(settings.STORAGES)
81+
if 'staticfiles' in new_storages:
82+
static_cfg = dict(new_storages['staticfiles'])
83+
static_cfg['BACKEND'] = 'eox_theming.theming.storage.EoxProductionStorage'
84+
new_storages['staticfiles'] = static_cfg
85+
settings.STORAGES = new_storages
7786

7887
settings.EOX_THEMING_DEFAULT_THEME_NAME = 'bragi'
7988

@@ -93,6 +102,4 @@ def plugin_settings(settings):
93102
settings.EOX_THEMING_CONFIGURATION_HELPER_BACKEND = 'eox_theming.edxapp_wrapper.backends.j_configuration_helpers'
94103
settings.EOX_THEMING_THEMING_HELPER_BACKEND = 'eox_theming.edxapp_wrapper.backends.j_theming_helpers'
95104
settings.EOX_THEMING_STORAGE_BACKEND = 'eox_theming.edxapp_wrapper.backends.l_storage'
96-
settings.STATICFILES_STORAGE = 'eox_theming.theming.storage.EoxProductionStorage'
97-
98105
settings.EOX_THEMING_EDXMAKO_BACKEND = 'eox_theming.edxapp_wrapper.backends.l_mako'

eox_theming/settings/devstack.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,10 @@ def plugin_settings(settings):
1414
'eox_theming.theming.finders.EoxThemeFilesFinder',
1515
] + settings.STATICFILES_FINDERS
1616

17-
settings.STATICFILES_STORAGE = 'eox_theming.theming.storage.EoxDevelopmentStorage'
17+
if hasattr(settings, 'STORAGES'):
18+
new_storages = dict(settings.STORAGES)
19+
if 'staticfiles' in new_storages:
20+
static_cfg = dict(new_storages['staticfiles'])
21+
static_cfg['BACKEND'] = 'eox_theming.theming.storage.EoxDevelopmentStorage'
22+
new_storages['staticfiles'] = static_cfg
23+
settings.STORAGES = new_storages

eox_theming/settings/test.py

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,15 @@
55
from __future__ import unicode_literals
66

77
import codecs
8+
import logging
89
import os
910

1011
import yaml
1112

1213
from .common import * # pylint: disable=wildcard-import
1314

15+
logger = logging.getLogger(__name__)
16+
1417

1518
class SettingsClass:
1619
""" dummy settings class """
@@ -60,9 +63,15 @@ def plugin_settings(settings): # pylint: disable=function-redefined
6063
for x in settings.MIDDLEWARE
6164
]
6265
except AttributeError:
63-
pass
64-
65-
settings.STATICFILES_STORAGE = 'openedx.core.storage.ProductionStorage'
66+
logger.error("Couldn't set MIDDLEWARE. Check your settings.")
67+
68+
if hasattr(settings, 'STORAGES'):
69+
new_storages = dict(settings.STORAGES)
70+
if 'staticfiles' in new_storages:
71+
static_cfg = dict(new_storages['staticfiles'])
72+
static_cfg['BACKEND'] = 'openedx.core.storage.ProductionStorage'
73+
new_storages['staticfiles'] = static_cfg
74+
settings.STORAGES = new_storages
6675

6776
settings.STATICFILES_FINDERS = [
6877
x for x in settings.STATICFILES_FINDERS if 'EoxThemeFilesFinder' not in x

requirements/base.txt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
11
#
2-
# This file is autogenerated by pip-compile with Python 3.11
2+
# This file is autogenerated by pip-compile with Python 3.12
33
# by the following command:
44
#
55
# make upgrade
66
#
7-
asgiref==3.10.0
7+
asgiref==3.11.1
88
# via django
9-
django==5.2.7
9+
django==5.2.11
1010
# via
1111
# -c requirements/constraints.txt
1212
# -r requirements/base.in
13-
eox-tenant==14.1.1
13+
eox-tenant==14.2.1
1414
# via -r requirements/base.in
1515
six==1.17.0
1616
# via -r requirements/base.in
17-
sqlparse==0.5.3
17+
sqlparse==0.5.5
1818
# via django

0 commit comments

Comments
 (0)