Locked lesson.
About this lesson
In this lesson, we'll discuss the importance of base.html files and how to create them within your project.
Exercise files
Download this lesson’s related exercise files.
Extends Base File.docx57.3 KB Extends Base File - Solution.docx
55.8 KB
Quick reference
Extends Base File
Extends allows us to break apart pieces of our website that are the same, and put them in one centrally located file.
When to use
Use extends base anytime you have elements of your website that are the same on every page of your site. Things like headers and footers are good examples.
Instructions
Your base.html file should look like this:
Header
{% block content %}
{% endblock%}
Footer
Your home.html file should look like this:
{% extends ‘base.html’ %}
{% block content %}
This is my home page! Woohoo!
{% endblock%}
Hints & tips
- Base Extends allows us to break apart our website into pieces that are easily updated.
Lesson notes are only available for subscribers.