Reputation: 118
What is the difference between these two named urls in Django?
re_path('articles/(?P<year>[0-9]{4})/', views.year_archive),
path('articles/<int:year>/', views.year_archive),
They appear to do the same?
Upvotes: 2
Views: 319
Reputation: 702
path
is a new style of url defining added in django 2.0 which has its own markupre_path
is a more advanced method that requires you to write your own regex for the url. This is the method all url patterns used in django <= 1.11if you using old style libraries in your django app you can use re_path
instead of url
of old version and if you creating new urls you can use either
Upvotes: 3