擅长:python、mysql、java
<p>用尤里、法比奥和弗罗斯特的话来解释Django noob(即我)的答案——几乎可以肯定是一个简化,但却是一个好的起点?</p>
<ul>
<li><p><code>render_to_response()</code>是“原始”的,但要求您几乎一直将<code>context_instance=RequestContext(request)</code>放入PITA中。</p></li>
<li><p><code>direct_to_template()</code>设计为仅在url.py中使用,而不在views.py中定义视图,但是它<a href="https://web.archive.org/web/20130527012805/http://www.import-awesome.com/youre-using-rendertoresponse-psh-heres-direct">can be used in views.py to avoid having to type RequestContext</a></p></li>
<li><p><code>render()</code>是自动提供<code>context_instance=Request</code>的<code>render_to_response()</code>的快捷方式。。。。
它在django开发版本(1.2.1)中可用,但许多人已经创建了自己的快捷方式,比如<a href="http://fi.am/entry/shortcutting-render_to_response/">this one</a>、<a href="http://djangosnippets.org/snippets/133/">this one</a>或者最初让我崩溃的那个,Nathans <a href="https://github.com/nathanborror/django-basic-apps/blob/master/basic/tools/shortcuts.py">basic.tools.shortcuts.py</a></p></li>
</ul>