pycharm感觉不太友好, 之前用过vscode感觉很好用, 还是用vscode吧.
1, 下载VScode, 配置中文
点击左下角, 找到chinese插件, 安装, 然后重启即可.
2, 在终端中安装python, 安装django, 新建一个testapp
点开新建终端, 类似cmd的窗口, 风格有点像linux, 用着比较方便.
django-admin startproject testapp cd testapp/ cd testapp/
结果如下:
$ python manage.py runserver 88 Performing system checks... System check identified no issues (0 silenced). You have 15 unapplied migration(s). Your project may not work properly until you apply the migrations for app(s): admin, auth, contenttypes, sessions. Run 'python manage.py migrate' to apply them. December 17, 2018 - 14:20:38 Django version 2.1.4, using settings 'testapp.settings' Starting development server at http://127.0.0.1:88/ Quit the server with CTRL-BREAK.
3, 打开网页:
可以看到django运行成功:
4, 设置皮肤
Material Icon Theme
Son of Obsidian Theme
然后点击右下角的设置按钮, 选择: 文件图标主题设置.
选择主题即可.
5, 设置高亮
点击设置:
点击这个图标:
然后选择工作区设置:
{ "editor.fontSize": 16, "explorer.confirmDragAndDrop": false, "extensions.autoUpdate": false, "workbench.colorTheme": "Son of Obsidian", "editor.fontFamily": "Consolas, Dengxian", "workbench.sideBar.location": "left", "workbench.startupEditor": "newUntitledFile", "workbench.iconTheme": "material-icon-theme", }
设置即可.
可以看到, 文件project中, 文件和文件夹都有了自己的图标, 很友好.
6, VScode设置django调试
在langsh中, 找到runserver, 设置端口:8080
如果python没有路径的设置, 可以点击:
然后:
设置路径, 注意windows是双斜杠.
7, 调试:
打开浏览器:
http://127.0.0.1:8080/
wonderfully