Commit 59086df8 authored by Evili del Rio's avatar Evili del Rio

Make health_urls compatible with Djang<2.0.0

Signed-off-by: default avatarEvili del Rio <evili.del.rio@gmail.com>
parent 274d0f2c
Pipeline #909 passed with stage
in 23 seconds
import importlib
from distutils.version import StrictVersion
from django import get_version
from django.conf import settings
from django.urls import path, include
urlpatterns = [
path('health_checks', include('health_check.urls')),
path('', include(settings.PROJECT_ROOT_URLCONF)),
]
__rt_version = get_version()
print("Django Version:", __rt_version)
if StrictVersion('2.0.0') > StrictVersion(__rt_version):
# Django <2.0, use url()
__urls = importlib.import_module('django.conf.urls')
#from django.urls import url, include
urlpatterns = [
__urls.url('^health_checks/', __urls.include('health_check.urls')),
__urls.url('^', include(settings.PROJECT_ROOT_URLCONF)),
]
else:
# Django >= 2.0, use path()
__urls = importlib.import_module('django.urls')
#from django.urls import path, include
urlpatterns = [
__urls.path('health_checks', __urls.include('health_check.urls')),
__urls.path('', __urls.include(settings.PROJECT_ROOT_URLCONF)),
]
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment