ubuntu20.04中vscode配置django

1.下载插件

我用的是这两个

ubuntu20.04中vscode配置django_第1张图片

2.配置环境

Ubuntu20.04创建虚拟环境

python3 -m venv .venv

ubuntu20.04中vscode配置django_第2张图片

没有 venv 的记得装一下

sudo apt install python3.8-venv

 装好之后,会出现  .venv 的文件夹

ubuntu20.04中vscode配置django_第3张图片

找一下 activate ,我的在 bin 里

按照提示

source bin/activate

完成后会显示(.venv)的虚拟环境,然后我们安装一下django

pip install django

ubuntu20.04中vscode配置django_第4张图片

 先用 help 试一下

ubuntu20.04中vscode配置django_第5张图片

 然后我们 startproject 试一下

django-admin startproject demo

目录里生成一个 demo 的文件夹

3.运行

python ./demo/manage.py runserver

ubuntu20.04中vscode配置django_第6张图片

然后去浏览器打开网页 http://127.0.0.1:8000/,看到这个算配置成功!

ubuntu20.04中vscode配置django_第7张图片

注意:

使用 debug 模式时,需要修改 launch.jason 中 “program” 路径

ubuntu20.04中vscode配置django_第8张图片

 

你可能感兴趣的:(vscode,django,ide)