A Second Page
Part of the Django Basics section of Coddy's Django journey. Lesson 2 of 23.
The café wants an About page. Django sends / to home because mysite/urls.py, the project's URLconf, says so:
urlpatterns = [
path("", views.home),
]Each path() pairs a route with a view. For a request to /faq/, Django drops the first slash, walks down urlpatterns and calls the view of the first route that matches faq/. When nothing matches, the answer is 404 Page not found.
So a new page takes two steps: a view in views.py, and a path() to it in urls.py. Routes end with a slash: "faq/", not "faq".
Challenge
EasyAdd an About page at /about/:
- in
menu/views.py, a viewaboutthat returnsCorner Café opened in 2026.; - in
mysite/urls.py, a route"about/"for it.
Press Run: the preview opens /about/.
Try it yourself
from django.urls import path
from menu import views
urlpatterns = [
path("", views.home),
]
All lessons in Django Basics
Practice on your own: Django playground