Skip to content

Commit 25f9f74

Browse files
committed
Add rough vscode debugging support
1 parent b74c1c9 commit 25f9f74

File tree

4 files changed

+30
-0
lines changed

4 files changed

+30
-0
lines changed

.vscode/launch.json

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
{
2+
"version": "0.2.0",
3+
"configurations": [
4+
{
5+
"name": "Python: Attach to Docker",
6+
"type": "python",
7+
"request": "attach",
8+
"connect": {
9+
"host": "localhost",
10+
"port": 12345
11+
},
12+
"pathMappings": [
13+
{
14+
"localRoot": "${workspaceFolder}",
15+
"remoteRoot": "/code"
16+
}
17+
]
18+
}
19+
]
20+
}

requirements-dev.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-c requirements.txt
22
django-debug-toolbar
33
pydevd-pycharm==243.22562.180 # pinned to appropriate version for current pycharm
4+
debugpy # for vscode debugging

requirements-dev.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@ asgiref==3.8.1
44
# via
55
# -c ./requirements.txt
66
# django
7+
debugpy==1.8.13
8+
# via -r ./requirements-dev.in
79
django==4.2.16
810
# via
911
# -c ./requirements.txt

vscode_debugger.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
def set_trace():
2+
import debugpy
3+
4+
# Listen on all interfaces at port 5678
5+
debugpy.listen(("172.17.0.1", 12345))
6+
print("Waiting for debugger to attach...")
7+
debugpy.wait_for_client() # Optional: pause execution until VS Code attaches

0 commit comments

Comments
 (0)