Add rough vscode debugging support

This commit is contained in:
Dave O'Connor
2025-03-25 08:54:44 -07:00
parent b74c1c9783
commit a7f5b80f49
4 changed files with 32 additions and 2 deletions

20
.vscode/launch.json vendored Normal file
View File

@@ -0,0 +1,20 @@
{
"version": "0.2.0",
"configurations": [
{
"name": "Python: Attach to Docker",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 12345
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "/code"
}
]
}
]
}

View File

@@ -1,3 +1,4 @@
-c requirements.txt
debugpy # for vscode debugging
django-debug-toolbar
pydevd-pycharm==243.22562.180 # pinned to appropriate version for current pycharm
pydevd-pycharm==243.26053.29 # pinned to appropriate version for current pycharm

View File

@@ -4,13 +4,15 @@ asgiref==3.8.1
# via
# -c ./requirements.txt
# django
debugpy==1.8.13
# via -r ./requirements-dev.in
django==4.2.16
# via
# -c ./requirements.txt
# django-debug-toolbar
django-debug-toolbar==4.4.6
# via -r ./requirements-dev.in
pydevd-pycharm==243.22562.180
pydevd-pycharm==243.26053.29
# via -r ./requirements-dev.in
sqlparse==0.5.1
# via

7
vscode_debugger.py Normal file
View File

@@ -0,0 +1,7 @@
def set_trace():
import debugpy
# Listen on all interfaces at port 5678
debugpy.listen(("172.17.0.1", 12345))
print("Waiting for debugger to attach...")
debugpy.wait_for_client() # Optional: pause execution until VS Code attaches