django all urls

urlpatterns = [ path('', views.index, name='index'), path('articles/', views.article_list, name='article_list'), path('articles//', views.article_detail, name='article_detail'), ]

  • This code block defines a list called urlpatterns, which contains URL patterns for the Django web application.
  • The 'path' function is used to define a URL pattern, which consists of three main parts: the URL string, the corresponding view function, and an optional name for the URL pattern.
  • The first URL pattern '' is mapped to the views.index function, with the name 'index'.
  • The second URL pattern 'articles/' is mapped to the views.article_list function, with the name 'article_list'.
  • The third URL pattern 'articles//' is mapped to the views.article_detail function, with the name 'article_detail'. The part captures an integer value from the URL and passes it as a parameter to the view function.