-1
我的上下文字典沒有發送到我的模板。 我有功能Django模板中沒有工作變量
from django.shortcuts import render_to_response
from django.template import RequestContext
def home(request):
return render_to_response('home.html',{'test':'test'},context_instance=RequestContext(request))
和我有簡單的模板,例如:
<html>
<body>
my test == {{test}}
</body>
</html>
,當我在瀏覽器中打開我的網站,我有「我的測試==」。 settings.py是默認值。我不使用自定義的東西。什麼問題? 服務器是帶有wsgi模塊的apache。
它使用內置的開發服務器中的django工作嗎? – dm03514
使用'{%debug%}'模板標籤找出錯誤。 –
你沒有定義什麼樣的測試是'test ='hello world',並作爲回報''test':測試'而不是'test':'test''。 – Goran