2011-07-05 7 views
2

サンプルアプリケーションを扱うDjangoの完全なnewbです。私はDjangoでテンプレートがどのように動作するかについて何か不足しているようです。レンダリングテンプレートDjangoと全く同じ

<!DOCTYPE HTML> 
<html> 
<head> 
<title>Zabba Dabba Doo</title> 
</head> 
<body> 
<h1>Zabba Dabba Doo</h1> 

<form action="/comparison/search/" method="get"> 
Search: <input type="text" name="search_terms" /> 
<input type="submit" value="Search" /> 
</form> 

</body> 
</html> 

views.py方法はここにある:

def home(request): 
    t = loader.get_template('comparison/index.html') 
    return HttpResponse(t) 

私は私のテンプレートからHTMLをレンダリングするビューメソッドを期待していますが、時に次のように

私はテンプレートファイルを持っています私はそれを試して、これは結果出力です:

<Text Node: '<!DOCTYPE HTML> 
<html> 
<h'> 

誰も私のテンプレートを作るように私に説明することができます正確に表示されますか?どんな助けもありがとうございます。

答えて

8

render itを忘れました。

+0

こんにちはAbrams、plsさんが私の質問を見ていただけますか? http://stackoverflow.com/questions/31085439/render-to-response-or-redirect-changes-the-template-elements-in-django-1-8 –

関連する問題