Skip to content
Justice Tech School

URL Routing

urls.py maps paths to views. Create blog/urls.py with path() entries and include it from the project urls.py.

Example
# blog/urls.py
from django.urls import path
from . import views

urlpatterns = [
    path("", views.index, name="index"),
]

# mysite/urls.py
from django.urls import include, path

urlpatterns = [
    path("blog/", include("blog.urls")),
]

Exercise

Include another URLconf.

path("blog/", ("blog.urls"))

Quiz Test

What does path() map?

These free lessons are for learning. Join a full course for projects, mentor feedback and a verified certificate.