Skip to content

Commit 8f1bb43

Browse files
committed
Create a VS Code Launch Configuration to attach to Django's runserver running via Docker Compose
1 parent d9199ec commit 8f1bb43

File tree

4 files changed

+27
-84
lines changed

4 files changed

+27
-84
lines changed

.dockerignore

Lines changed: 14 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,14 @@
1-
.coverage
2-
.idea/
3-
.mypy_cache/**/*
4-
.pytest_cache/**/*
5-
.ruff_cache/**/*
6-
**/__pycache__
7-
**/.classpath
8-
**/.dockerignore
9-
**/.env
10-
**/.git
11-
**/.gitignore
12-
**/.project
13-
**/.settings
14-
**/.toolstarget
15-
**/.venv
16-
**/.vs
17-
**/.vscode
18-
**/*.*proj.user
19-
**/*.dbmdl
20-
**/*.jfm
21-
**/bin
22-
**/charts
23-
**/compose*
24-
**/docker-compose*
25-
**/Dockerfile*
26-
**/node_modules
27-
**/npm-debug.log
28-
**/obj
29-
**/secrets.dev.yaml
30-
**/values.dev.yaml
31-
db.sqlite
32-
docs_site/
33-
htmlcov
34-
latest.dump
35-
LICENSE
36-
public/static/dist
37-
README.md
1+
**/.venv
2+
*console.log
3+
.coverage
4+
.env
5+
.idea/
6+
.mypy_cache/**/*
7+
.pytest_cache/**/*
8+
.ruff_cache/**/*
9+
db.sqlite
10+
docs_site/
11+
htmlcov
12+
latest.dump
13+
node_modules
14+
public/static/dist

.vscode/launch.json

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,17 @@
55
"version": "0.2.0",
66
"configurations": [
77
{
8-
"name": "Docker: Python - Django",
9-
"type": "docker",
10-
"request": "launch",
11-
"preLaunchTask": "docker-run: debug",
12-
"python": {
13-
"pathMappings": [
14-
{
15-
"localRoot": "${workspaceFolder}",
16-
"remoteRoot": "/srv/app"
17-
}
18-
],
19-
"projectType": "django"
20-
}
8+
"name": "Django Runserver Attach",
9+
"type": "python",
10+
"request": "attach",
11+
"port": 5678,
12+
"host": "localhost",
13+
"pathMappings": [
14+
{
15+
"localRoot": "${workspaceFolder}",
16+
"remoteRoot": "/srv/app"
17+
}
18+
]
2119
}
2220
]
23-
}
21+
}

.vscode/tasks.json

Lines changed: 0 additions & 32 deletions
This file was deleted.

docker-compose.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ services:
2929
target: dev
3030
dockerfile: config/docker/Dockerfile.web
3131

32-
command: ["sh", "-c", "./manage.py migrate --noinput && pip install debugpy -t /tmp && python /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:8000 --nothreading --noreload"]
32+
command: ["sh", "-c", "./manage.py migrate --noinput && pip install debugpy -t /tmp && python -Xfrozen_modules=off /tmp/debugpy --wait-for-client --listen 0.0.0.0:5678 manage.py runserver 0.0.0.0:8000 --nothreading"]
3333

3434
volumes:
3535
- .:/srv/app:cached

0 commit comments

Comments
 (0)