0
我,从我的模板dir函数返回一个页面,成功的,没问题的看法:Django的扩展不包括子文件
def home(request):
c = {}
return render_to_response('home.html', c, context_instance=RequestContext(request))
如果home.html的是一个简单的网页没有延伸,它会返回正常。但是,如果我使用include,比如说{%extends“base.html”%},那么只需返回base.html,而不添加子home.html中的内容。什么可能导致这个?
home.html的
{% extends "base.html" %}
{% block title %}Home{% endblock %}
{% block content %}
This is the homepage.
{% endblock %}
base.html文件
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>{% block content %}{% endblock %}</title>
</head>
<body>
{% block content %}{% endblock %}
</body>
</html>
目前,此函数返回base.html文件的副本是这样的:
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>
</head>
<body>
</body>
</html>
为什么不包括在内内容或标题栏?
太谢谢你了!你是一个绅士和学者。一旦SO时间限制通过,我会接受你的答案:) – LittleBobbyTables
@LittleBobbyTables感谢您的友好的话! – Rohan