TemplateView for simple pages
📖 Scenario: You are building a simple website with a homepage and an about page. You want to use Django's TemplateView to serve these pages without writing extra view logic.
🎯 Goal: Create two simple pages using Django's TemplateView: a homepage and an about page. Each page should display a heading with its name.
📋 What You'll Learn
Create a Django URL pattern for the homepage using
TemplateViewCreate a Django URL pattern for the about page using
TemplateViewUse the correct template names:
home.html and about.htmlEach template should have a heading with the page name
💡 Why This Matters
🌍 Real World
Many websites have simple pages like home and about that do not need complex logic. Using TemplateView lets you serve these pages quickly and cleanly.
💼 Career
Understanding TemplateView is useful for Django developers to build maintainable websites with minimal code for static pages.
Progress0 / 4 steps