From 8e3016118633d6e8d138970e4be427e5f4a0d6c5 Mon Sep 17 00:00:00 2001 From: M Sajid Mansoori Date: Thu, 1 Oct 2020 00:08:42 +0530 Subject: [PATCH] Modified the urls to use path function instead of using url function with regex --- project/urls.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/project/urls.py b/project/urls.py index 5c6a8e36..a68a157b 100644 --- a/project/urls.py +++ b/project/urls.py @@ -1,7 +1,7 @@ from django.conf import settings from django.conf.urls import include, url from django.contrib import admin - +from django.urls import path # This path is much easier to use without using regular expressions and supported in django 3.0 and higher from welcome.views import index, health urlpatterns = [ @@ -9,9 +9,14 @@ urlpatterns = [ # url(r'^$', 'project.views.home', name='home'), # url(r'^blog/', include('blog.urls')), - url(r'^$', index), - url(r'^health$', health), - url(r'^admin/', include(admin.site.urls)), + # Below commented urls will also work but the latest support for path function is much efficient to use + # url(r'^$', index), + # url(r'^health$', health), + # url(r'^admin/', include(admin.site.urls)), + + path('',index), + path('health/',health), + path('admin/',include(admin.site.urls)) ] if settings.DEBUG: