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, Django responds with 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 have no slash at the start and one at the end: "faq/", not "/faq/" or "faq".
Challenge
EasyAdd an About page.
- In
menu/views.py, add a viewaboutthat returnsCorner Café opened in 2026. - In
mysite/urls.py, add a routeabout/that points toviews.about. Routes never start with a slash.
Open /about/ to see it.
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