diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..c0cfa93 --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,22 @@ +{ + "version": "0.2.0", + "configurations": [ + + { + "name": "IPT Django", + "type": "debugpy", + "request": "attach", + "pathMappings": [ + { + "localRoot": "${workspaceFolder}", + "remoteRoot": "/code" + } + ], + "connect": { + "port": 5020, + "host": "localhost", + }, + "justMyCode": false + } + ] +} \ No newline at end of file diff --git a/backend/debugpy.py b/backend/debugpy.py new file mode 100644 index 0000000..2b1435b --- /dev/null +++ b/backend/debugpy.py @@ -0,0 +1,15 @@ +import os +import debugpy +import logging + +def config_to_bool(value): + return str(value).lower() in ('true', '1', 'yes', 'on') + +def check_and_enable_debugpy(): + debugpy_enable = config_to_bool(os.getenv('DEBUGPY_ENABLE', False)) + debugpy_address = '0.0.0.0' + debugpy_port = 5020 + + if debugpy_enable: + logging.debug('DEBUGPY: Enabled Listening on ({0}:{1})'.format(debugpy_address, debugpy_port)) + debugpy.listen((debugpy_address, debugpy_port)) \ No newline at end of file diff --git a/backend/wsgi.py b/backend/wsgi.py index c3a803c..eca573b 100644 --- a/backend/wsgi.py +++ b/backend/wsgi.py @@ -11,6 +11,10 @@ from django.core.wsgi import get_wsgi_application +from backend.debugpy import check_and_enable_debugpy + os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') +check_and_enable_debugpy() + application = get_wsgi_application() diff --git a/docker-compose.yml b/docker-compose.yml index e79b799..1341b78 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -29,6 +29,7 @@ services: - ${HOME}/mylasecrets:/secrets ports: - "5000:5000" + - "5020:5020" container_name: canvas_app_explorer env_file: - .env diff --git a/requirements.txt b/requirements.txt index aabc50a..13541a0 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,4 +1,4 @@ -gunicorn==22.0.0 +gunicorn==23.0.0 mysqlclient==2.1.1 # Django and related @@ -19,11 +19,13 @@ drf-spectacular==0.22.1 markdown==3.4.1 # Markdown support for the browsable API # LTI -pycryptodome==3.19.1 # For generating LTI keys -PyLTI1p3==1.12.1 +pycryptodome==3.21.0 # For generating LTI keys +PyLTI1p3==2.0.0 # Canvas canvasapi==3.3.0 +debugpy==1.8.8 + # Not in pypi https://github.com/Harvard-University-iCommons/django-canvas-oauth https://github.com/Harvard-University-iCommons/django-canvas-oauth/archive/v1.1.1.tar.gz