---
title: "模板"
version: 5.1
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/5.1/ref/templates/
canonical: https://djangodocs.dev/zh-hans/5.1/ref/templates/
---
# 模板

Django 的模板引擎提供了一个强大的迷你语言来定义你的应用程序的面向用户层，鼓励应用程序和表现逻辑的清晰分离。任何懂 HTML 的人都可以维护模板，不需要 Python 知识。关于入门材料，请参见 [模板](/zh-hans/5.1/topics/templates/) 主题指南。

- [Django 模板语言](/zh-hans/5.1/ref/templates/language/)

  - [模板](/zh-hans/5.1/ref/templates/language/#templates)
  - [变量](/zh-hans/5.1/ref/templates/language/#variables)
  - [过滤器](/zh-hans/5.1/ref/templates/language/#filters)
  - [标签](/zh-hans/5.1/ref/templates/language/#tags)
  - [注释](/zh-hans/5.1/ref/templates/language/#comments)
  - [模板继承](/zh-hans/5.1/ref/templates/language/#template-inheritance)
  - [自动 HTML 转义](/zh-hans/5.1/ref/templates/language/#automatic-html-escaping)
  - [访问方法调用](/zh-hans/5.1/ref/templates/language/#accessing-method-calls)
  - [自定义标签和过滤器库](/zh-hans/5.1/ref/templates/language/#custom-tag-and-filter-libraries)
- [内置模板标签和过滤器](/zh-hans/5.1/ref/templates/builtins/)

  - [内置标签参考](/zh-hans/5.1/ref/templates/builtins/#built-in-tag-reference)
  - [内置过滤器参考](/zh-hans/5.1/ref/templates/builtins/#built-in-filter-reference)
  - [国际化标签和过滤器](/zh-hans/5.1/ref/templates/builtins/#internationalization-tags-and-filters)
  - [其他标签和过滤器库](/zh-hans/5.1/ref/templates/builtins/#other-tags-and-filters-libraries)
- [Django 模板语言：对于 Python 开发者](/zh-hans/5.1/ref/templates/api/)

  - [概况](/zh-hans/5.1/ref/templates/api/#overview)
  - [设置引擎](/zh-hans/5.1/ref/templates/api/#configuring-an-engine)
  - [加载模板](/zh-hans/5.1/ref/templates/api/#loading-a-template)
  - [渲染上下文](/zh-hans/5.1/ref/templates/api/#rendering-a-context)
  - [使用 `Context` 对象](/zh-hans/5.1/ref/templates/api/#playing-with-context-objects)
  - [加载模板](/zh-hans/5.1/ref/templates/api/#loading-templates)
  - [自定义加载器](/zh-hans/5.1/ref/templates/api/#custom-loaders)
  - [模板起源](/zh-hans/5.1/ref/templates/api/#template-origin)

> **See also**
>
> 关于编写自定义标签和过滤器的信息，请参见 [如何编写自定义的模板标签和过滤器](/zh-hans/5.1/howto/custom-template-tags/)。
>
> 要学习如何在其他 Django 应用中覆盖模板，请看 [如何覆盖模板](/zh-hans/5.1/howto/overriding-templates/)。
