Django: Getting Started Transcripts
Chapter: HTML Templates
Lecture: Chapter review
Login or
purchase this course
to watch this video and the rest of the course contents.
0:00
this chapter has been all about Django templates and how you can use this feature to apply the dry principle to your HTML templates.
0:09
Do actions through tags which are often similar to key words in Python.
0:15
You saw loops, condition als and inheritance to construct Web pages along with tags. The template in language also has filters.
0:26
These help you change the presentation of data in the templates context. This gives better separation between the data and its presentation.
0:35
For example, you could format a date inside of the template possibly based on a user's preferences instead of doing that in the view,
0:44
views frequently used templates. So, Django has a shortcut method called render that renders a template.
0:50
It takes a context dictionary for the rendering and returns an http response object.
0:57
HTML contains content of course, and some of that content references other content. Django refers to these outside references as static files.
1:07
These include CSS javascript and image files. Although the Django dev server will output these files to make your dev experience simpler.
1:17
Django shouldn't be responsible for them in production as such. Django provides tools for managing these kinds of files.
1:24
I'll talk more about this in the chapter on deployment inside of your HTML templates. You used the static tag which maps the URL.
1:33
S to the actual static files, which allows them to live in different places in dev staging and production.
1:41
A special case of a static file is the favor con which browsers expect to be in the root of the server.
1:47
Using the redirect view helper. You can serve favor icons using the static system and map the route you are L to a static directory.
1:55
Instead, through the redirect 302, I showed you how to register a route you RL itself by mapping the empty string inside of the base you RLS file.
2:08
Finally, I sprinkled a little bit of bootstrap into your jangle course just so the
2:12
pages could be a little prettier in the next chapter will take you from rendering content to storing data. Oh. RM is on deck.