---
title: "部署 Django"
version: 3.0
locale: zh-hans
source: https://docs.djangoproject.com/zh-hans/3.0/howto/deployment/
canonical: https://djangodocs.dev/zh-hans/3.0/howto/deployment/
---
# 部署 Django

Django is full of shortcuts to make Web developers' lives easier, but all
those tools are of no use if you can't easily deploy your sites. Since Django's
inception, ease of deployment has been a major goal.

There are many options for deploying your Django application, based on your
architecture or your particular business needs, but that discussion is outside
the scope of what Django can give you as guidance.

Django, being a web framework, needs a web server in order to operate. And
since most web servers don't natively speak Python, we need an interface to
make that communication happen.

Django currently supports two interfaces: WSGI and ASGI.

- [WSGI](https://wsgi.readthedocs.io/en/latest/) is the main Python standard for communicating between Web servers and
  applications, but it only supports synchronous code.
- [ASGI](https://asgi.readthedocs.io/en/latest/) is the new, asynchronous-friendly standard that will allow your
  Django site to use asynchronous Python features, and asynchronous Django
  features as they are developed.

You should also consider how you will handle [static files](/zh-hans/3.0/howto/static-files/deployment/) for your application, and how to handle
[error reporting](/zh-hans/3.0/howto/error-reporting/).

Finally, before you deploy your application to production, you should run
through our [deployment checklist](/zh-hans/3.0/howto/deployment/checklist/) to ensure that your
configurations are suitable.

- [如何使用 WSGI 进行部署](/zh-hans/3.0/howto/deployment/wsgi/)

  - [如何使用 Gunicorn 托管 Django](/zh-hans/3.0/howto/deployment/wsgi/gunicorn/)
  - [如何用 uWSGI 托管 Django](/zh-hans/3.0/howto/deployment/wsgi/uwsgi/)
  - [如何使用 Apache 和 `mod_wsgi` 托管 Django](/zh-hans/3.0/howto/deployment/wsgi/modwsgi/)
  - [Apache 利用 Django 的用户数据库进行验证](/zh-hans/3.0/howto/deployment/wsgi/apache-auth/)
  - [`application` 对象](/zh-hans/3.0/howto/deployment/wsgi/#the-application-object)
  - [配置 settings 模块](/zh-hans/3.0/howto/deployment/wsgi/#configuring-the-settings-module)
  - [应用 WSGI 中间件](/zh-hans/3.0/howto/deployment/wsgi/#applying-wsgi-middleware)
- [如何使用 ASGI 来部署](/zh-hans/3.0/howto/deployment/asgi/)

  - [How to use Django with Daphne](/zh-hans/3.0/howto/deployment/asgi/daphne/)
  - [How to use Django with Uvicorn](/zh-hans/3.0/howto/deployment/asgi/uvicorn/)
  - [`application` 对象](/zh-hans/3.0/howto/deployment/asgi/#the-application-object)
  - [配置 settings 模块](/zh-hans/3.0/howto/deployment/asgi/#configuring-the-settings-module)
  - [Applying ASGI middleware](/zh-hans/3.0/howto/deployment/asgi/#applying-asgi-middleware)
- [部署静态文件](/zh-hans/3.0/howto/static-files/deployment/)

  - [在生产环境提供静态文件服务](/zh-hans/3.0/howto/static-files/deployment/#serving-static-files-in-production)
  - [了解更多](/zh-hans/3.0/howto/static-files/deployment/#learn-more)
- [发送错误](/zh-hans/3.0/howto/error-reporting/)

  - [通过邮件方式报告](/zh-hans/3.0/howto/error-reporting/#email-reports)
  - [过滤错误报告](/zh-hans/3.0/howto/error-reporting/#filtering-error-reports)
- [部署清单](/zh-hans/3.0/howto/deployment/checklist/)

  - [运行 `manage.py check --deploy`](/zh-hans/3.0/howto/deployment/checklist/#run-manage-py-check-deploy)
  - [关键配置](/zh-hans/3.0/howto/deployment/checklist/#critical-settings)
  - [特定于环境的配置](/zh-hans/3.0/howto/deployment/checklist/#environment-specific-settings)
  - [HTTPS](/zh-hans/3.0/howto/deployment/checklist/#https)
  - [性能优化](/zh-hans/3.0/howto/deployment/checklist/#performance-optimizations)
  - [发送错误](/zh-hans/3.0/howto/deployment/checklist/#error-reporting)
