快速安装指南Link to this heading

开始用 Django 前,需要先进行安装。我们写了 :doc:` 完整安装指南</topics/install>` 罗列了各种安装方法和情况;它会指导你完成一个简易安装,只要你按照指示操作,就可以运行得起来。

安装 PythonLink to this heading

作为一个 Python Web 框架,Django 需要 Python。更多细节请参见 我应该使用哪个版本的 Python 来配合 Django?。Python 包含了一个名为 SQLite 的轻量级数据库,所以你暂时不必自行设置一个数据库。

最新版本的 Python 可以通过访问 https://www.python.org/downloads/ 或者操作系统的包管理工具获取。

你可以在你的 shell 中输入 python 来确定你是否安装过 Python;你看到的可能是像这样子的:

Code
Python 3.x.y
[GCC 4.x] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>>

设置数据库Link to this heading

此步骤仅在你打算使用诸如 PostgreSQL, MariaDB, MySQL, 或者 Oracle 这些大型数据库引擎时需要。要安装这种数据库, 请参考 database installation information

安装 DjangoLink to this heading

安装 Django有以下三种方式:

验证Link to this heading

若要验证 Django 是否能被 Python 识别,可以在 shell 中输入 python。 然后在 Python 提示符下,尝试导入 Django:

>>> import django
>>> print(django.get_version())
3.0

当然了,你也可能安装的是其它版本的 Django。

搞定!Link to this heading

搞定,现在你可以 move onto the tutorial