From 53c99af2c4c5eb21fb29d67f528cf5c2e5adc82d Mon Sep 17 00:00:00 2001 From: Andrew Chen Wang <60190294+Andrew-Chen-Wang@users.noreply.github.com> Date: Sat, 21 Aug 2021 20:55:33 -0400 Subject: [PATCH] Fix Django 3.2 default_app_config deprecation (#198) * Fix ImportError from setup.py --- cachalot/__init__.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/cachalot/__init__.py b/cachalot/__init__.py index 6bbab99..0d0c44c 100644 --- a/cachalot/__init__.py +++ b/cachalot/__init__.py @@ -1,4 +1,10 @@ VERSION = (2, 4, 2) __version__ = ".".join(map(str, VERSION)) -default_app_config = "cachalot.apps.CachalotConfig" +try: + from django import VERSION as DJANGO_VERSION + + if DJANGO_VERSION < (3, 2): + default_app_config = "cachalot.apps.CachalotConfig" +except ImportError: + default_app_config = "cachalot.apps.CachalotConfig"