【发布时间】:2015-04-08 12:41:04
【问题描述】:
在 django 模板中使用以下代码时:
<!DOCTYPE html>
<html lang="en">
<head>
<link href="http://52.11.183.14/static/wiki/bootstrap/css/wiki-bootstrap.css" type="text/css" rel="stylesheet"/>
<link href="http://52.11.183.14/static/wiki/bootstrap/css/simple-sidebar.css" type="text/css" rel="stylesheet"/>
<title> Profile - Technology βιβλιοθήκη </title>
</head>
<body>
<div class="container">
{% for p in profiles %}
{{p}}
{% endfor %}
</div>
</body>
</html>
我收到以下错误:
This XML file does not appear to have any style information associated with it. The document tree is shown below.
为什么?我能做些什么来解决它?
已解决:通过更改 render_to_response 上的 HttpResponse
my_context={'profiles': profiles}
c = RequestContext(request,{'profiles': profiles})
return render_to_response('wiki/profile.html',
my_context,
context_instance=RequestContext(request))
#return HttpResponse(t.render(c), content_type="application/xhtml+xml")
【问题讨论】:
-
我们如何重现这个错误?
-
跳过 {% for p in profile %} {{p}} {% endfor %}
-
@AndreyEremchuk 您在哪里看到错误?简单地在浏览器中打开 HTML 文件永远不会产生这样的错误...
-
我使用 django 模板处理器/在浏览器中简单打开
标签: python html css xml django