Skip to content

Commit 4e77896

Browse files
authored
feat: support django 4.2 new STORAGES format
test: also run tests on Django 4.2 and Python 3.11
1 parent a950cd3 commit 4e77896

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.github/workflows/test.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ jobs:
77
runs-on: ubuntu-latest
88
strategy:
99
matrix:
10-
python-version: ['3.7', '3.8', '3.9', '3.10']
10+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
1111
target: [pil, imagemagick, graphicsmagick, redis, wand, dbm]
1212

1313
include:

sorl/thumbnail/conf/defaults.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from django.conf import settings
2+
from django.core.exceptions import ImproperlyConfigured
23

34
# When True ThumbnailNode.render can raise errors
45
THUMBNAIL_DEBUG = False
@@ -31,7 +32,10 @@
3132
THUMBNAIL_VIPSHEADER = 'vipsheader'
3233

3334
# Storage for the generated thumbnails
34-
THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE
35+
try:
36+
THUMBNAIL_STORAGE = settings.STORAGES['default']['BACKEND']
37+
except (AttributeError, KeyError, ImproperlyConfigured):
38+
THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE
3539

3640
# Redis settings
3741
THUMBNAIL_REDIS_DB = 0

tox.ini

+4-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,14 @@ python =
44
3.8: py38
55
3.9: py39
66
3.10: py310
7+
3.11: py311
78

89
[gh-actions:env]
910
DJANGO =
1011
3.2: django32
1112
4.0: django40
1213
4.1: django41
14+
4.2: django42
1315
TARGET =
1416
pil: pil
1517
imagemagick: imagemagick
@@ -24,7 +26,7 @@ skipsdist = True
2426
envlist =
2527
py38-qa,
2628
py37-django32-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}
27-
py{38,39,310}-django{32,40,41}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}
29+
py{38,39,310,311}-django{32,40,41,42}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}
2830

2931
[testenv]
3032
deps =
@@ -39,6 +41,7 @@ deps =
3941
django32: django>=3.2,<3.3
4042
django40: django>=4.0,<4.1
4143
django41: django>=4.1,<4.2
44+
django42: django>=4.2,<4.3
4245

4346
setenv =
4447
PYTHONPATH = {toxinidir}:{toxinidir}

0 commit comments

Comments
 (0)