0
0
omoscar muΓ±oz
urlpatterns += path('articles/', views.articles, name='articles'),
The above code declares two urlpatterns. The first one, path('', views.index, name='index'), will be called when no urlpattern is specified. The second one, path('articles/', views.articles, name='articles'), will be called when the articles urlpattern is encountered.
urlpatterns = [
path('', views.index, name='index'),
]
urlpatterns += path('articles/', views.articles, name='articles'),
In the above example, the path('articles/', views.articles, name='articles') will be called when a urlpattern is encountered that matches articles/ in the URL.
Library: django
Shortcut: urls
Filename pattern: .py
from django.urls import path
from import views
urlpatterns = [
path('', views.index, name='index'),
]