---
title: "contrib 包"
version: 4.1
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/4.1/ref/contrib/
canonical: https://djangodocs.dev/zh-hans/4.1/ref/contrib/
---
# `contrib` 包

Django aims to follow Python's ["batteries included" philosophy](https://docs.python.org/3/tutorial/stdlib.html#tut-batteries-included). It ships with a variety of extra, optional tools
that solve common web development problems.

这段代码位于 Django 发行版中的 `django/contrib` 中。本文档给出了 `contrib` 中的包的概要，以及这些包的依赖关系。

> **注解**
>
> For most of these add-ons -- specifically, the add-ons that include either
> models or template tags -- you'll need to add the package name (e.g.,
> `'django.contrib.redirects'`) to your [`INSTALLED_APPS`](/zh-hans/4.1/ref/settings/#std-setting-INSTALLED_APPS) setting
> and rerun `manage.py migrate`.

- [Django 管理站点](/zh-hans/4.1/ref/contrib/admin/)
- [`django.contrib.auth`](/zh-hans/4.1/ref/contrib/auth/)
- [内容类型框架](/zh-hans/4.1/ref/contrib/contenttypes/)
- [简单页面应用](/zh-hans/4.1/ref/contrib/flatpages/)
- [GeoDjango](/zh-hans/4.1/ref/contrib/gis/)
- [`django.contrib.humanize`](/zh-hans/4.1/ref/contrib/humanize/)
- [消息框架](/zh-hans/4.1/ref/contrib/messages/)
- [`django.contrib.postgres`](/zh-hans/4.1/ref/contrib/postgres/)
- [重定向应用](/zh-hans/4.1/ref/contrib/redirects/)
- [站点地图框架](/zh-hans/4.1/ref/contrib/sitemaps/)
- [“站点”框架](/zh-hans/4.1/ref/contrib/sites/)
- [`staticfiles` 应用](/zh-hans/4.1/ref/contrib/staticfiles/)
- [Feed 聚合框架](/zh-hans/4.1/ref/contrib/syndication/)

## `admin`

Django 自动管理界面。更多信息请参见 [教程 2](/zh-hans/4.1/intro/tutorial02/) 和 [管理文档](/zh-hans/4.1/ref/contrib/admin/)。

需要安装 [auth](#auth) 和 [contenttypes](#contenttypes) contrib 包。

## `auth`

Django 的认证框架。

参见 [Django中的用户认证](/zh-hans/4.1/topics/auth/)。

## `contenttypes`

一个轻量级的框架，用于钩入 “多种类型” 的内容，每个安装的 Django 模型都是一个独立的内容类型。

参见 [contenttypes 文档](/zh-hans/4.1/ref/contrib/contenttypes/)。

## `flatpages`

一个在数据库中管理 “简单” HTML 内容的框架。

参见 [简单页面文档](/zh-hans/4.1/ref/contrib/flatpages/)。

需要同时安装 [sites](#sites) contrib 包。

## `gis`

一个建立在 Django 之上的世界级地理空间框架，可以实现空间数据的存储、操作和显示。

参见 [GeoDjango](/zh-hans/4.1/ref/contrib/gis/) 文档。

## `humanize`

一套 Django 模板过滤器，用于为数据添加 “人情味”。

参见 [人性化文档](/zh-hans/4.1/ref/contrib/humanize/)。

## `messages`

一个存储和检索基于 cookie 或会话的临时消息的框架。

参见 [消息文档](/zh-hans/4.1/ref/contrib/messages/)。

## `postgres`

一个 PostgreSQL 特定功能的集合。

参见 [contrib.postgres 文档](/zh-hans/4.1/ref/contrib/postgres/)。

## `redirects`

一个管理重定向的框架。

参见 [重定向文档](/zh-hans/4.1/ref/contrib/redirects/)。

## `sessions`

一个在匿名会话中存储数据的框架。

参见 [会话文档](/zh-hans/4.1/topics/http/sessions/)。

## `sites`

一个轻量级的框架，可以让你在同一个数据库和 Django 安装下操作多个网站。它为你提供了将对象关联到一个或多个网站的钩子。

参见 [站点文档](/zh-hans/4.1/ref/contrib/sites/)。

## `sitemaps`

一个用于生成 Google 网站地图 XML 文件的框架。

参见 [站点地图文档](/zh-hans/4.1/ref/contrib/sitemaps/)。

## `syndication`

以 RSS 和 Atom 形式很容易地生成聚合 feed 的框架。

参见 [聚合框架文档](/zh-hans/4.1/ref/contrib/syndication/)。

## 其他附加功能

如果你有一个关于 `contrib` 的功能的想法，请告诉我们！把它写成代码，并发布到 [django-users](/zh-hans/4.1/internals/mailing-lists/#django-users-mailing-list) 邮件列表。
