Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
HTML Templates | Templates
Django: Build Your First Website
course content

Course Content

Django: Build Your First Website

Django: Build Your First Website

1. Get Started
2. The First Application
3. Models
4. CRUD Operations
5. Templates
6. Forms and Dynamic URLs

book
HTML Templates

In Django, templates are files used to display dynamic content on your website pages. Django templates help separate logic and presentation, providing a clean and organized approach to web application development.

Key concepts of Django templates

  • Built-in Tags and Filters: Django templates have built-in tags and filters that allow you to perform various actions in the template, such as outputting variables, iterating over lists, using conditional expressions, and more;

  • Inheritance System: You can use template inheritance to create base templates containing common page elements and extend them for specific pages on your website;

  • Context Variables: Django allows you to pass data from your Python code (context) to the template so that you can display this data on the page;

  • URL Patterns: Django also uses templates to define URL patterns. You can use regular expressions and other constructs to specify the structure of your URLs;

  • Static Files: Django enables you to handle static files, such as CSS, JavaScript, and images, using special tags and functions.

The main idea is that you define the structure and appearance of your HTML code in the template, and Django fills these templates with specific data when rendering the page. This allows you to create dynamic and reusable pages in your web application.

Task

📁 Create a templates folder in the Django application folder.

Everything was clear?

How can we improve it?

Thanks for your feedback!

Section 5. Chapter 1
We're sorry to hear that something went wrong. What happened?
some-alt