解决方法,一共三步,在debug错误信息里面已经指出:
from django.template import RequestContext
…
…
return render_to_response('my_template.html',
my_data_dictionary,
context_instance=RequestContext(request))
或: c = RequestContext(request, {
'foo': 'bar',
}, [ip_address_processor])
return HttpResponse(t.render(c))
<form action="/contact/" method="post">
{% csrf_token %}
<p>Subject: <input type="text" name="subject" /></p>
<p>Your e-main (optional): <input type="text" name="email" /></p>
<p>Message: <textarea name="message" rows="10" cols="50"></textarea></p>
<input type="submit" value="Submit" />
</form>