Skip to content

Instantly share code, notes, and snippets.

@AliciaMoses
Created July 17, 2024 19:10
Show Gist options
  • Save AliciaMoses/e29fc90c78186606b5a480e40f1ced61 to your computer and use it in GitHub Desktop.
Save AliciaMoses/e29fc90c78186606b5a480e40f1ced61 to your computer and use it in GitHub Desktop.
VSCode Pytest + Django Launch Config
{
"version": "0.2.0",
"configurations": [
{
"name": "Test Current File",
"type": "debugpy",
"request": "launch",
"module": "pytest",
"args": [
"${file}",
"--create-db",
"-p no:pytest-pycharm",
"-p no:pycharm",
"--color=yes",
],
"console": "integratedTerminal",
"cwd": "${workspaceFolder}",
"django": true,
"env": {
"DJANGO_SETTINGS_MODULE": "FOO",
"DJANGO_CONFIGURATION": "BAR",
},
},
{
"name": "Test Management Command",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/src/manage.py",
"env": {
"DJANGO_CONFIGURATION": "FOO"
},
"args": [
"FILENAME_WITHOUT_EXTENSION"
],
"console": "integratedTerminal"
},
{
"name": "Test App via Client",
"type": "debugpy",
"request": "launch",
"program": "${workspaceFolder}/src/manage.py",
"args": [
"runserver",
"8002" // Port number of choice
],
"envFile": "${workspaceFolder}/.env",
"django": true,
"justMyCode": false,
"env": {
"DJANGO_SETTINGS_MODULE": "FOO",
"DJANGO_CONFIGURATION": "BAR",
}
},
],
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment