扩展base.html后,我的孩子html内容未显示

时间:2018-12-25 19:27:27

标签: html django django-templates django-views

在扩展之前,我检查了所有连接和文件路径,但在扩展子代码之后,我检查了

base.html

<!DOCTYPE html>
{% load staticfiles%}
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="{% static '/images/icon.png' %}" />
<title>allgood.com</title>
<link href="{% static "/css/base.css" %}" rel="stylesheet" 
type="text/css"/>
</head>
<body>
<div class="header">
<span class="name">allgood</span>
<button class="btn1 ">Resume</button>
<button class="btn2 ">resume</button>
<span class="profileimage"><img src="{%static '/images/profile1.png' 
%}"  style="width:40px;height:40px"></span>

</div>
</body>
</html>

skill.html

{% extends 'app/base.html' %}

 {% block content %}
 <p>skills</p>
 <p>skills</p>
 <p>skills</p>
 {% endblock %}

1 个答案:

答案 0 :(得分:2)

您的base.html文件仍应包含阻止部分

<!DOCTYPE html>
{% load staticfiles%}
<html lang="en" dir="ltr">
<head>
<meta charset="utf-8">
<link rel="icon" type="image/x-icon" href="{% static '/images/icon.png' %}" />
<title>allgood.com</title>
<link href="{% static "/css/base.css" %}" rel="stylesheet" 
type="text/css"/>
</head>
<body>
<div class="header">
<span class="name">allgood</span>
<button class="btn1 ">Resume</button>
<button class="btn2 ">resume</button>
<span class="profileimage"><img src="{%static '/images/profile1.png' 
%}"  style="width:40px;height:40px"></span>
   {% block content %}
   {% endblock %}
</div>
</body>
</html>