Home > Back-end >  Run Django server using the run button in visual studio code
Run Django server using the run button in visual studio code

Time:10-18

In pyCharm we have this option where we can configure Run button to start the server by adding the same to the script path.

enter image description here

I wanted to do the same in visual studio code, so that whenever I click Run, my django server gets started.

CodePudding user response:

You need to create a launch.json in the folder .vscode which sits in the same folder as your 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
        },
    ]
}

You can create one by clicking run & debug and then at top menu green triangle click add configuration, python, Django

CodePudding user response:

You can change the configuration in the Run and Debug sidebar:

enter image description here

  • Related