diff --git a/cas_server/tests/urls.py b/cas_server/tests/urls.py index b95c228..ac8295f 100644 --- a/cas_server/tests/urls.py +++ b/cas_server/tests/urls.py @@ -16,12 +16,11 @@ Including another URLconf import django -if django.VERSION < (2,): - from django.conf.urls import url - re_path = url -else: +try: from django.urls import re_path - +except ImportError: + # re_path is not available in Django 2 + from django.conf.urls import url as re_pa from django.conf.urls import url, include from django.contrib import admin diff --git a/cas_server/urls.py b/cas_server/urls.py index 680c61e..301157c 100644 --- a/cas_server/urls.py +++ b/cas_server/urls.py @@ -13,12 +13,12 @@ import django -if django.VERSION < (2,): - from django.conf.urls import url - re_path = url -else: - from django.urls import re_path +try: + from django.urls import re_path +except ImportError: + # re_path is not available in Django 2 + from django.conf.urls import url as re_path from django.conf.urls import url from django.views.generic import RedirectView