From 705a48b8bbad05b424a3282998f13c4b2b66a90e Mon Sep 17 00:00:00 2001 From: Anthony Geourjon <anthony.geourjon@tetras-libre.fr> Date: Thu, 2 Feb 2023 13:57:36 +0100 Subject: [PATCH] Try to add debbuger in docker https://www.python-engineer.com/posts/debug-python-docker/ --- .vscode/launch.json | 24 ++++++++++++++++++++++++ Mirador_backend/app.py | 12 ++++++++++++ ports.yml | 1 + setup.py | 1 + 4 files changed, 38 insertions(+) create mode 100644 .vscode/launch.json diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..daab14f --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,24 @@ +{ + // Use IntelliSense to learn about possible attributes. + // Hover to view descriptions of existing attributes. + // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "Python: Remote Attach", + "type": "python", + "request": "attach", + "connect": { + "host": "localhost", + "port": 5678 + }, + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "." + } + ], + "justMyCode": true + } + ] +} \ No newline at end of file diff --git a/Mirador_backend/app.py b/Mirador_backend/app.py index cfaa7ac..5f34f14 100644 --- a/Mirador_backend/app.py +++ b/Mirador_backend/app.py @@ -7,6 +7,12 @@ from Mirador_backend.routes import v1 from Mirador_backend.utils.config import getConfig from Mirador_backend.utils.database import db + +import debugpy +# TODO Update debugger +debugpy.listen(("0.0.0.0", 5678)) + + app = Flask(__name__) api = Api(app) docs = FlaskApiSpec(app) @@ -21,5 +27,11 @@ def shutdown_session(exception=None): db.close() + if __name__ == '__main__': app.run(debug=True) + + + + +print('COucou') \ No newline at end of file diff --git a/ports.yml b/ports.yml index ffa57f2..0b03674 100644 --- a/ports.yml +++ b/ports.yml @@ -4,3 +4,4 @@ services: flask: ports: - $FLASK_PORT:5000 + - 5678:5678 # DEBUG ports diff --git a/setup.py b/setup.py index 0f9c647..c437ef3 100644 --- a/setup.py +++ b/setup.py @@ -41,6 +41,7 @@ setup( "python-dotenv", # For a nice shell "ipython", + 'debugpy' ], setup_requires=[""], -- GitLab