Django Book 翻译
菜单>:
TOC
返回
原文:
If ``get_template()`` cannot find the template with the given name, it raises a ``TemplateDoesNotExist`` exception. To see what that looks like, fire up the Django development server again, as in Chapter 3, by running ``python manage.py runserver`` within your Django projects directory. Then, point your browser at the page that activates the ``current_datetime`` view (e.g., ``http://127.0.0.1:8000/time/`` ). Assuming your ``DEBUG`` setting is set to ``True`` and you havent yet created a ``current_datetime.html`` template, you should see a Django error page highlighting the ``TemplateDoesNotExist`` error.
翻译:
如果 ``get_template()`` 找不到给定名称的模板,将会引发一个 ``TemplateDoesNotExist`` 异常。要了解究竟会发生什么,让我们按照第三章内容,在 Django 项目目录中运行 ``python manage.py runserver`` 命令,再次启动Django开发服务器。。然后,用浏览器访问页面(如: ``http://127.0.0.1:8000/time/`` ) 激活 ``current_datetime`` 视图。假如 ``DEBUG`` 设置为 ``True`` 而又未创建 ``current_datetime.html`` 模板,你将会看到 ``TemplateDoesNotExist`` 错误信息页面。
备注:
译者: