diff --git a/dbtemplates/management/commands/sync_templates.py b/dbtemplates/management/commands/sync_templates.py index 269cc15..7d95429 100644 --- a/dbtemplates/management/commands/sync_templates.py +++ b/dbtemplates/management/commands/sync_templates.py @@ -65,7 +65,7 @@ class Command(BaseCommand): tpl_dirs = app_template_dirs + DIRS else: tpl_dirs = DIRS + app_template_dirs - templatedirs = [d for d in tpl_dirs if os.path.isdir(d)] + templatedirs = [str(d) for d in tpl_dirs if os.path.isdir(d)] for templatedir in templatedirs: for dirpath, subdirs, filenames in os.walk(templatedir): diff --git a/dbtemplates/utils/cache.py b/dbtemplates/utils/cache.py index 98f63f7..53f0078 100644 --- a/dbtemplates/utils/cache.py +++ b/dbtemplates/utils/cache.py @@ -1,3 +1,4 @@ +import django from django.core import signals from django.contrib.sites.models import Site from django.template.defaultfilters import slugify @@ -9,8 +10,12 @@ def get_cache_backend(): """ Compatibilty wrapper for getting Django's cache backend instance """ - from django.core.cache import _create_cache - cache = _create_cache(settings.DBTEMPLATES_CACHE_BACKEND) + if django.VERSION[0] >= 3 and django.VERSION[1] >= 2: + from django.core.cache import caches + cache = caches.create_connection(settings.DBTEMPLATES_CACHE_BACKEND) + else: + from django.core.cache import _create_cache + cache = _create_cache(settings.DBTEMPLATES_CACHE_BACKEND) # Some caches -- python-memcached in particular -- need to do a cleanup at # the end of a request cycle. If not implemented in a particular backend # cache.close is a no-op diff --git a/tox.ini b/tox.ini index c36793c..dbde404 100644 --- a/tox.ini +++ b/tox.ini @@ -12,7 +12,6 @@ envlist = [gh-actions] python = - 3.5: py36 3.6: py36 3.7: py37 3.8: py38, flake8 @@ -21,7 +20,6 @@ python = [testenv] basepython = - py35: python3.5 py36: python3.6 py37: python3.7 py38: python3.8 @@ -32,9 +30,6 @@ setenv = DJANGO_SETTINGS_MODULE = dbtemplates.test_settings deps = -r requirements/tests.txt - dj111: Django<2.0 - dj20: Django<2.1 - dj21: Django<2.2 dj22: Django<2.3 dj30: Django<3.1 dj31: Django<3.2 @@ -50,7 +45,7 @@ commands = coverage xml [testenv:flake8] -basepython = python3.8 +basepython = python3.9 commands = flake8 dbtemplates deps = flake8