From 8a85a97a336369f46009b08f457a6df6674c43c6 Mon Sep 17 00:00:00 2001 From: Sam Arbid Date: Tue, 19 Nov 2024 21:41:19 +0100 Subject: [PATCH] docs: add VS Code debugging config --- docs/develop/getting-started/debugging.md | 40 +++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/docs/develop/getting-started/debugging.md b/docs/develop/getting-started/debugging.md index 5be56b91..0e7fcba0 100644 --- a/docs/develop/getting-started/debugging.md +++ b/docs/develop/getting-started/debugging.md @@ -11,6 +11,46 @@ To set a breakpoint place the following code: breakpoint() ``` +## VS Code Debugger + +To debug InvenioRDM using VS Code, configure the debugger with Flask settings: + +From your instance, create or edit `.vscode/launch.json`. +Add the following configuration, see link for more information: [VS Code debugging](https://code.visualstudio.com/docs/python/debugging) + +```json +// .vscode/launch.json +{ + "configurations": [ + { + "name": "Invenio Debugger", + "type": "python", + "request": "launch", + "module": "flask", + "env": { + "FLASK_APP": "invenio_app.wsgi:application", + "FLASK_ENV": "development", + "FLASK_DEBUG": "1", + "WERKZEUG_RUN_MAIN": "watchdog" + }, + "args": [ + "run", + "--host", + "0.0.0.0", + "--cert", + "${workspaceFolder}/docker/nginx/test.crt", + "--key", + "${workspaceFolder}/docker/nginx/test.key" + ], + "jinja": true, + "justMyCode": false + } + ] +} +``` + +Start debugging in VS Code by selecting Invenio Debugger in the debug panel and clicking Run. + **Flask DebugToolbar** You can also install [Flask-DebugToolbar](https://flask-debugtoolbar.readthedocs.io/en/latest/):