admin管理员组文章数量:1406951
<!-- about.html -->
1 {% extends 'book/base.html' %}
2
3 {% block title %} About {% endblock %}
4 {% block extra_head %}
5 <link rel="stylesheet" href="{% static 'css/style.css' %}">
6 {% endblock %}
7 {% block header %}
8 <h1> About Me </h1>
9 {% endblock %}
10 {% block main %}
11 <article>
12 <section> <p>My name is Uyiosasere Idemudia Oduware</p>
13 </section>
14 </article>
15 {% endblock %}
base.html
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %} Uyi's Page {% endblock %}</title>
{% block extra_head %}
{% endblock %}
</head>
<body>
<header>
{% block header %}
{% endblock %}
</header>
<main>
{% block main %}
{% endblock %}
</main>
<footer>
{% block footer %}
{% endblock %}
</footer>
</body>
</html>
my css file is inside LearnSphere/book/static/css/style.css
the base.html and about.html file is inside Learnsphere/book/templates/book/base.html about.html
<!-- about.html -->
1 {% extends 'book/base.html' %}
2
3 {% block title %} About {% endblock %}
4 {% block extra_head %}
5 <link rel="stylesheet" href="{% static 'css/style.css' %}">
6 {% endblock %}
7 {% block header %}
8 <h1> About Me </h1>
9 {% endblock %}
10 {% block main %}
11 <article>
12 <section> <p>My name is Uyiosasere Idemudia Oduware</p>
13 </section>
14 </article>
15 {% endblock %}
base.html
{% load static %}
<!DOCTYPE html>
<html>
<head>
<title>{% block title %} Uyi's Page {% endblock %}</title>
{% block extra_head %}
{% endblock %}
</head>
<body>
<header>
{% block header %}
{% endblock %}
</header>
<main>
{% block main %}
{% endblock %}
</main>
<footer>
{% block footer %}
{% endblock %}
</footer>
</body>
</html>
my css file is inside LearnSphere/book/static/css/style.css
the base.html and about.html file is inside Learnsphere/book/templates/book/base.html about.html
Share edited Mar 6 at 20:24 Uyi Oduware asked Mar 6 at 20:22 Uyi OduwareUyi Oduware 12 bronze badges1 Answer
Reset to default 0You need to {% load static %}
in each template where it is used. Add it to the top of about.html
instead of base.html
.
本文标签:
版权声明:本文标题:django - I keep getting this issue Invalid block tag on line 5: 'static', expected 'endblock'. D 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744951382a2634104.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论