Skip to content

Commit

Permalink
feat: support django 4.2 new STORAGES format
Browse files Browse the repository at this point in the history
test: also run tests on Django 4.2 and Python 3.11
  • Loading branch information
bellini666 authored Apr 5, 2023
1 parent a950cd3 commit 4e77896
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.7', '3.8', '3.9', '3.10']
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11']
target: [pil, imagemagick, graphicsmagick, redis, wand, dbm]

include:
Expand Down
6 changes: 5 additions & 1 deletion sorl/thumbnail/conf/defaults.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured

# When True ThumbnailNode.render can raise errors
THUMBNAIL_DEBUG = False
Expand Down Expand Up @@ -31,7 +32,10 @@
THUMBNAIL_VIPSHEADER = 'vipsheader'

# Storage for the generated thumbnails
THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE
try:
THUMBNAIL_STORAGE = settings.STORAGES['default']['BACKEND']
except (AttributeError, KeyError, ImproperlyConfigured):
THUMBNAIL_STORAGE = settings.DEFAULT_FILE_STORAGE

# Redis settings
THUMBNAIL_REDIS_DB = 0
Expand Down
5 changes: 4 additions & 1 deletion tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ python =
3.8: py38
3.9: py39
3.10: py310
3.11: py311

[gh-actions:env]
DJANGO =
3.2: django32
4.0: django40
4.1: django41
4.2: django42
TARGET =
pil: pil
imagemagick: imagemagick
Expand All @@ -24,7 +26,7 @@ skipsdist = True
envlist =
py38-qa,
py37-django32-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}
py{38,39,310}-django{32,40,41}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}
py{38,39,310,311}-django{32,40,41,42}-{pil,imagemagick,graphicsmagick,redis,dynamodb,wand,pgmagick,dbm,vipsthumbnail}

[testenv]
deps =
Expand All @@ -39,6 +41,7 @@ deps =
django32: django>=3.2,<3.3
django40: django>=4.0,<4.1
django41: django>=4.1,<4.2
django42: django>=4.2,<4.3

setenv =
PYTHONPATH = {toxinidir}:{toxinidir}
Expand Down

0 comments on commit 4e77896

Please sign in to comment.