1. 程式人生 > 其它 >【VS Code】設定

【VS Code】設定

1. 基礎命令

  1. 終端 ctrl ~
  2. 命令面板 ctrl shift P

2. python 環境配置

  1. 開啟外掛中心, 安裝 python外掛
  2. 開啟命令面板, 搜尋 python 選擇 Python: Select interpreter
  3. 進入後選擇 python安裝路徑
  4. 開啟終端, 新增cmd執行環境

3. django 環境配置

  1. 開啟外掛中心, 安裝 django外掛
  2. 開啟終端, 進入python直譯器環境, 安裝 django框架 pip3 install django
  3. 新增 launch.json檔案, 選擇 Python --> Django 啟動並除錯 Django Web應用
// launch.json檔案
{
    // 使用 IntelliSense 瞭解相關屬性。 
    // 懸停以檢視現有屬性的描述。
    // 欲瞭解更多資訊,請訪問: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Python: Django",
            "type": "python",
            "request": "launch",
            "program": "${workspaceFolder}\\manage.py",
            "args": [
                "runserver",
                "192.168.20.106:8801", // ip 埠
                // "--noreload"  // 取消自動重啟
            ],
            "django": true,
            "justMyCode": true
        }
    ]
}

4. 隱藏 pycache 資料夾

  1. 開啟命令列 ctrl shift P
  2. 輸入 settings 找到 open user setting
  3. 搜尋 files.exclude
  4. 新增 **/__pycache__ 即可