diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d9119ba..28d220d 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,8 +8,9 @@ jobs: build: runs-on: ubuntu-latest strategy: + fail-fast: false matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"] steps: - uses: actions/checkout@v4 diff --git a/README.md b/README.md index 5cf9acd..43e2c87 100644 --- a/README.md +++ b/README.md @@ -29,9 +29,13 @@ Usage ----- In `settings.py`, add `binary_database_files` to your `INSTALLED_APPS` and add -this line: +this: - DEFAULT_FILE_STORAGE = 'binary_database_files.storage.DatabaseStorage' + STORAGES = { + "default": { + "BACKEND": "binary_database_files.storage.DatabaseStorage" + } + } Note, the `upload_to` parameter is still used to synchronize the files stored in the database with those on the file system, so new and existing fields diff --git a/binary_database_files/tests/tests.py b/binary_database_files/tests/tests.py index 5854175..04fdd37 100644 --- a/binary_database_files/tests/tests.py +++ b/binary_database_files/tests/tests.py @@ -6,6 +6,7 @@ from io import BytesIO from zipfile import ZipFile +import django from django.conf import settings from django.core import files from django.core.files import File as DjangoFile @@ -23,10 +24,20 @@ DIR = os.path.abspath(os.path.split(__file__)[0]) -set_default_file_storage = functools.partial( - override_settings, - DEFAULT_FILE_STORAGE="binary_database_files.storage.DatabaseStorage", -) +if django.VERSION <= (4, 2): + # DEFAULT_FILE_STORAGE was deprecated in 4.2 (https://https://docs.djangoproject.com/en/dev/releases/4.2/#id1) + # remove this when 4.2 is not supported anymore + set_default_file_storage = functools.partial( + override_settings, + DEFAULT_FILE_STORAGE="binary_database_files.storage.DatabaseStorage", + ) +else: + set_default_file_storage = functools.partial( + override_settings, + STORAGES={ + "default": {"BACKEND": "binary_database_files.storage.DatabaseStorage"} + }, + ) class DatabaseFilesTestCase(TestCase): diff --git a/setup.py b/setup.py index c08f443..33ae1eb 100644 --- a/setup.py +++ b/setup.py @@ -52,16 +52,14 @@ def get_reqs(*fns): "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", - "Framework :: Django :: 2.2", - "Framework :: Django :: 3.0", - "Framework :: Django :: 3.1", - "Framework :: Django :: 3.2", - "Framework :: Django :: 4.0", - "Framework :: Django :: 5.0", + "Programming Language :: Python :: 3.13", + "Framework :: Django :: 4.2", + "Framework :: Django :: 5.1", + "Framework :: Django :: 5.2", ], install_requires=get_reqs( "pip-requirements.txt", ), tests_require=get_reqs("pip-requirements-test.txt"), - python_requires=">=3.6,<3.13", + python_requires=">=3.6", ) diff --git a/tox.ini b/tox.ini index 93d4ac5..d0d558a 100644 --- a/tox.ini +++ b/tox.ini @@ -4,7 +4,7 @@ ignore = W503, E203 # See https://github.com/PyCQA/pycodestyle/issues/373 max-line-length=160 [tox] -envlist = py{38,39,310,311,312}-django{32,40},py{310,311,312}-django{50} +envlist = py{38,39,310,311,312}-django{42},py{310,311,312}-django{50},py{310,311,312,313}-django{51,52} recreate = True [gh-actions] @@ -14,6 +14,7 @@ python = 3.10: py310 3.11: py311 3.12: py312 + 3.13: py313 [testenv] basepython = @@ -22,12 +23,11 @@ basepython = py310: python3.10 py311: python3.11 py312: python3.12 + py313: python3.13 deps = -r{toxinidir}/pip-requirements-test.txt - django22: Django>=2.2,<2.3 - django30: Django>=3.0,<3.1 - django31: Django>=3.1,<3.2 - django32: Django>=3.2,<3.3 - django40: Django>=4.0,<5.0 - django50: Django>=5.0,<6.0 + django42: Django==4.2.* + django50: Django==5.0.* + django51: Django==5.1.* + django52: Django==5.2.* commands = django-admin test --traceback --pythonpath=. --settings=binary_database_files.tests.settings binary_database_files.tests.tests.DatabaseFilesTestCase{env:TESTNAME:}