Updated static file example in overview to use static template tag, refs #19675.
Thanks jezdez for the note.
This commit is contained in:
parent
f49e9a517f
commit
9e959e8d58
|
@ -271,17 +271,18 @@ Finally, Django uses the concept of "template inheritance": That's what the
|
||||||
following blocks." In short, that lets you dramatically cut down on redundancy
|
following blocks." In short, that lets you dramatically cut down on redundancy
|
||||||
in templates: each template has to define only what's unique to that template.
|
in templates: each template has to define only what's unique to that template.
|
||||||
|
|
||||||
Here's what the "base.html" template, including the use of :doc:`static files
|
Here's what the "base.html" template, including the use of :doc:`static files
|
||||||
</howto/static-files>`, might look like:
|
</howto/static-files>`, might look like:
|
||||||
|
|
||||||
.. code-block:: html+django
|
.. code-block:: html+django
|
||||||
|
|
||||||
|
{% load static %}
|
||||||
<html>
|
<html>
|
||||||
<head>
|
<head>
|
||||||
<title>{% block title %}{% endblock %}</title>
|
<title>{% block title %}{% endblock %}</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<img src="{{ STATIC_URL }}images/sitelogo.png" alt="Logo" />
|
<img src="{% static "images/sitelogo.png" %}" alt="Logo" />
|
||||||
{% block content %}{% endblock %}
|
{% block content %}{% endblock %}
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
Loading…
Reference in New Issue