Is there a way to run a Django project from VSCODE editor?
Currently I use the windows CMD to run my project. Every time when I hit the button 'run' on VSCODE it doesn't run the project.
On pyCharm we can add 'runserver' to its script parameters configurations. Is there something like that on VSCODE?
UPDATE
I'm getting this on VSCODE terminal:
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
Here is how I did: From Terminal -> Configure Tasks...
{
"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"
           }
       }
   ]
}
Afterwards, it should show up, when you select Terminal -> Run Task...
I'm in Linux if you are different environment please provide approprite command
Ctrl + Shift + p and type >python: Select Interpreter Please select your virtualenv which Django installed.
And Go to Debug ( Ctrl + Shift + d ) and these...
{
    // 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": "Django",
            "type": "python",
            "request": "launch",
            "stopOnEntry": true,
            "pythonPath": "${config:python.pythonPath}",
            "program": "${workspaceRoot}/manage.py",
            "cwd": "${workspaceRoot}",
            "args": [
                "runserver",
                "--noreload",
                "--nothreading"
            ],
            "env": {},
            "envFile": "${workspaceRoot}/.env",
            "debugOptions": [
                "WaitOnAbnormalExit",
                "WaitOnNormalExit",
                "RedirectOutput",
                "DjangoDebugging"
            ]
        }
    ]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With