1. 下载安装 Python
https://www.python.org/downlo…
> py --version
Python 3.9.1
2. 创立一个名为 my-project 的虚拟环境并激活
> py -m venv my-project
# 批改 PowerShell 对于脚本的执行策略
> set-executionpolicy remotesigned
# 激活虚拟环境
> my-project\Scripts\activate.bat
3. 装置 Django
> py -m pip install Django
> django-admin --version
3.1.4
4. 创立一个名为 mysite 的我的项目
> django-admin startproject mysite
5. 查看创立后的目录构造
mysite/
manage.py
mysite/
__init__.py
asgi.py
settings.py
urls.py
wsgi.py
6. 启动服务
> python manage.py runserver 8000
Watching for file changes with StatReloader
Performing system checks...
...
Django version 3.1.4, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
7. 拜访 http://127.0.0.1:8000/ 测试服务运行状况