Django Book 翻译
菜单>:
TOC
返回
原文:
Here were treating ``direct_to_template`` like any other function. Since it returns an ``HttpResponse`` , we can simply return it as-is. The only slightly tricky business here is dealing with missing templates. We dont want a nonexistent template to cause a server error, so we catch ``TemplateDoesNotExist`` exceptions and return 404 errors instead.
翻译:
在这里我们象使用其他函数一样使用 ``direct_to_template`` 。因为它返回一个 ``HttpResponse`` 对象,我们只需要简单的返回它就好了。有一个稍微复杂的地方,要处理没有找到模板的情况。 我们不希望一个不存在的模板引发服务器错误,所以我们捕捉 ``TempalteDoesNotExist`` 异常 并返回404错误。
备注:
译者: