Chapter 22 · 10 min read
Snippet 1
Snippet 1
A shop app has the following URL tables. Read them carefully, then answer the questions.
# config/urls.py
from django.contrib import admin
from django.urls import include, path
urlpatterns = [
path("admin/", admin.site.urls),
path("shop/", include("shop.urls")),
]
# shop/urls.py
from django.urls import path
from . import views
app_name = "shop"
urlpatterns = [
path("", views.index, name="index"),
path("item/<int:pk>/", views.detail, name="detail"),
path("item/<slug:slug>/", views.by_slug, name="by_slug"),
]
