---
title: "如何使用 Gunicorn 托管 Django"
version: 3.0
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/3.0/howto/deployment/wsgi/gunicorn/
canonical: https://djangodocs.dev/zh-hans/3.0/howto/deployment/wsgi/gunicorn/
---
# 如何使用 Gunicorn 托管 Django

[Gunicorn](https://gunicorn.org/) ('Green Unicorn') is a pure-Python WSGI server for UNIX. It has no
dependencies and can be installed using `pip`.

## 安装 Gunicorn

Install gunicorn by running `python -m pip install gunicorn`. For more
details, see the [gunicorn documentation](https://docs.gunicorn.org/en/latest/install.html).

## 把 Django 当作普通 WSGI 应用在 Gunicorn 中运行

When Gunicorn is installed, a `gunicorn` command is available which starts
the Gunicorn server process. The simplest invocation of gunicorn is to pass the
location of a module containing a WSGI application object named
`application`, which for a typical Django project would look like:

```bash
gunicorn myproject.wsgi
```

这样会创建一个进程，包含了一个监听在 `127.0.0.1:8000` 的线程。前提是你的项目在 Python path 中，要满足这个条件，最简单的方法是在 `manage.py` 文件所在的目录中运行这条命令。

更多技巧请参考 Gunicorn 的 [部署文档](https://docs.gunicorn.org/en/latest/deploy.html) 。
