从 VSCODE 运行 Django 项目

Fil*_*ipe 3 django visual-studio-code

有没有办法从 VSCODE 编辑器运行 Django 项目?

目前我使用 Windows CMD 来运行我的项目。每次当我在 VSCODE 上点击“运行”按钮时,它都不会运行该项目。

在 pyCharm 上,我们可以将“runserver”添加到其脚本参数配置中。VSCode 上有类似的东西吗?

更新

我在 VSCODE 终端上得到这个:

Type 'manage.py help <subcommand>' for help on a specific subcommand.

Available subcommands:

[auth]
    changepassword
    createsuperuser

[contenttypes]
    remove_stale_contenttypes

[django]
    check
    compilemessages
    createcachetable
    dbshell
    diffsettings
    dumpdata
    flush
    inspectdb
    loaddata
    makemessages
    makemigrations
    migrate
    sendtestemail
    shell
    showmigrations
    sqlflush
    sqlmigrate
    sqlsequencereset
    squashmigrations
    startapp
    startproject
    test
    testserver

[sessions]
    clearsessions

[staticfiles]
    collectstatic
    findstatic
    runserver

[Done] exited with code=0 in 9.449 seconds
Run Code Online (Sandbox Code Playgroud)

sca*_*ola 5

这是我的做法:从终端 -> 配置任务...

{
"version": "2.0.0",
"tasks": [
    {
        "label": "Django: Run Server",
        "type": "shell",
        "command": "${config:python.pythonPath}",
        "args":[ 
               "manage.py",
               "runserver"
         ],
        "group": "none",
        "presentation": {
            "reveal": "always",
            "panel": "new"
           }
       }
   ]
}
Run Code Online (Sandbox Code Playgroud)

然后,当您选择“终端”->“运行任务...”时,它应该会显示出来。