debug launch options + project init & launch tasks

This commit is contained in:
Orce MARINKOVSKI 2024-12-25 12:38:05 +00:00
parent 1614fdec86
commit 6660326d29
2 changed files with 199 additions and 141 deletions

View File

@ -2,41 +2,48 @@
"version": "0.2.0", "version": "0.2.0",
"configurations": [ "configurations": [
{ {
"name": "manage.py runserver", "name": "Chrome: Debug Angular Frontend",
"type": "chrome",
"request": "launch",
"url": "http://localhost:4200",
"webRoot": "${workspaceFolder}/src-ui",
"preLaunchTask": "Start: Frontend Angular"
},
{
"name": "Debug: Backend Server (manage.py runserver)",
"type": "python", "type": "python",
"request": "launch", "request": "launch",
"program": "${workspaceFolder}/src/manage.py", "program": "${workspaceFolder}/src/manage.py",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["runserver"], "args": ["runserver"],
"django": true "django": true,
},
{
"name": "manage.py document_consumer",
"type": "python",
"request": "launch",
"program": "${workspaceFolder}/src/manage.py",
"console": "integratedTerminal",
"justMyCode": true,
"args": ["document_consumer"],
"django": true
},
{
"name": "celery",
"type": "python",
"cwd": "${workspaceFolder}/src",
"request": "launch",
"module": "celery",
"console": "integratedTerminal", "console": "integratedTerminal",
"env": { "env": {
"PYTHONPATH": "${workspaceFolder}/src" "PYTHONPATH": "${workspaceFolder}/src"
}, },
"args": [ "python": "${workspaceFolder}/.venv/bin/python"
"-A", },
"paperless", {
"worker", "name": "Debug: Consumer Service (manage.py document_consumer)",
"-l", "type": "python",
"DEBUG" "request": "launch",
"program": "${workspaceFolder}/src/manage.py",
"args": ["document_consumer"],
"django": true,
"console": "integratedTerminal",
"env": {
"PYTHONPATH": "${workspaceFolder}/src"
},
"python": "${workspaceFolder}/.venv/bin/python"
}
],
"compounds": [
{
"name": "Debug: FullStack",
"configurations": [
"Chrome: Debug Angular Frontend",
"Debug: Backend Server (manage.py runserver)",
"Debug: Consumer Service (manage.py document_consumer)"
] ]
} }
] ]

View File

@ -2,7 +2,56 @@
"version": "2.0.0", "version": "2.0.0",
"tasks": [ "tasks": [
{ {
"label": "manage.py document_consumer", "label": "Start: Frontend Angular",
"type": "shell",
"command": "npm start",
"isBackground": true,
"options": {
"cwd": "${workspaceFolder}/src-ui"
},
"problemMatcher": [
{
"owner": "custom",
"pattern": [
{
"regexp": ".",
"file": 1,
"location": 2,
"message": 3
}
],
"background": {
"activeOnStart": true,
"beginsPattern": ".*",
"endsPattern": "Compiled successfully"
}
}
],
"detail": "triggered also by launch option Chrome: Debug Angular Frontend"
},
{
"label": "Start: Celery Worker",
"type": "shell",
"command": "pipenv run celery --app paperless worker -l DEBUG",
"group": {
"kind": "build",
"isDefault": true
},
"presentation": {
"echo": true,
"reveal": "always",
"focus": true,
"panel": "shared",
"showReuseMessage": false,
"clear": true,
"revealProblems": "onProblem"
},
"options": {
"cwd": "${workspaceFolder}/src"
}
},
{
"label": "Start: Consumer Service (manage.py document_consumer)",
"type": "shell", "type": "shell",
"command": "pipenv run python manage.py document_consumer", "command": "pipenv run python manage.py document_consumer",
"group": "build", "group": "build",
@ -18,10 +67,9 @@
"options": { "options": {
"cwd": "${workspaceFolder}/src" "cwd": "${workspaceFolder}/src"
} }
}, },
{ {
"label": "manage.py runserver", "label": "Start: Backend Server (manage.py runserver)",
"type": "shell", "type": "shell",
"command": "pipenv run python manage.py runserver", "command": "pipenv run python manage.py runserver",
"group": "build", "group": "build",
@ -37,7 +85,6 @@
"options": { "options": {
"cwd": "${workspaceFolder}/src" "cwd": "${workspaceFolder}/src"
} }
}, },
{ {
"label": "Maintenance: manage.py migrate", "label": "Maintenance: manage.py migrate",
@ -76,7 +123,7 @@
} }
}, },
{ {
"label": "compile frontend", "label": "Maintenance: Compile frontend for production",
"type": "shell", "type": "shell",
"command": "npm ci && ./node_modules/.bin/ng build --configuration production", "command": "npm ci && ./node_modules/.bin/ng build --configuration production",
"group": "none", "group": "none",
@ -112,25 +159,29 @@
} }
}, },
{ {
"label": "Celery Worker", "label": "Maintenance: Install Angular Frontend for Debug",
"type": "shell", "type": "npm",
"command": "pipenv run celery --app paperless worker -l DEBUG", "script": "install",
"group": { "path": "src-ui",
"kind": "build", "group": "clean",
"isDefault": true "problemMatcher": [],
"detail": "install dependencies from package"
}, },
"presentation": { {
"echo": true, "label": "Project Setup: Run all Init Tasks",
"reveal": "always", "dependsOn": [
"focus": true, "Maintenance: manage.py migrate",
"panel": "shared", "Maintenance: manage.py createsuperuser",
"showReuseMessage": false, "Maintenance: Compile frontend for production"
"clear": true, ]
"revealProblems": "onProblem"
}, },
"options": { {
"cwd": "${workspaceFolder}/src" "label": "Project Start: Run all Services",
} "dependsOn": [
"Start: Celery Worker",
"Start: Consumer Service (manage.py document_consumer)",
"Start: Backend Server (manage.py runserver)"
]
} }
] ]
} }