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/ 测试服务运行情况