0
當使用在Django模板下面的代碼:此XML文件似乎沒有任何與其關聯的樣式信息。文檔樹顯示below.2
<!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.
爲什麼?我能做些什麼來解決它?
解決:通過改變上的HttpResponse選擇render_to_response
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")
我們如何重現這個錯誤? –
skip {%for p in profiles%} {{p}} {%endfor%} –
@AndreyEremchuk您在哪裏看到錯誤?簡單地在瀏覽器中打開HTML文件應該永遠不會產生這樣的錯誤... – har07