[英]Run Django server using the run button in visual studio code
在 pyCharm 中,我們有這個選項,我們可以在其中配置
Run button<\/code>以通過將其添加到腳本路徑來啟動服務器。
我想在 Visual Studio 代碼中做同樣的事情,這樣每當我點擊運行時,我的 django 服務器就會啟動。
您需要在文件夾.vscode
創建一個launch.json
,該文件夾與您的manage.py
位於同一文件夾中。
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: 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",
],
"django": true
},
]
}
您可以通過單擊run & debug
創建一個,然后在頂部菜單綠色三角形單擊add configuration
、 python
、 Django
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.