DEV Community

Discussion on: Debug Python and Django easily from Visual Studio Code

Collapse
bigj1m profile image
Jean-Michel Plourde

Nice article! I will try that for sure since I work with Django. I was wondering if there is any way for running unit test and functional test. I currently use Intellij Idea, while the cost is a bit high for me, it is really powerful. I'm willing to try new products.

Collapse
javaguirre profile image
Javier Aguirre Author

Thank you! There is actually! :-)

As you may know you can use
python manage.py test
to run all your tests, so from VS Code you could use it like:

{
    "name": "Django: Test",
    "type": "python",
    "request": "launch",
    "program": "${workspaceFolder}/manage.py",
    "env": {"DJANGO_SETTINGS_MODULE": "myproject.settings.test"},
    "args": [
        "test"
    ],
    "django": true
}

you can put it on your launch.json and you’re good to go!