From 2f15a6c9c76d5531c8b8d3d70d51f5118c06298a Mon Sep 17 00:00:00 2001 From: alhendrickson <159636032+alhendrickson@users.noreply.github.com.> Date: Mon, 9 Mar 2026 11:20:26 +0000 Subject: [PATCH] chore(medcat-trainer): Enable livereloading in dev --- medcat-trainer/docker-compose-dev.yml | 1 + medcat-trainer/webapp/scripts/run.sh | 9 ++++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/medcat-trainer/docker-compose-dev.yml b/medcat-trainer/docker-compose-dev.yml index abd3509d9..f90fce63f 100644 --- a/medcat-trainer/docker-compose-dev.yml +++ b/medcat-trainer/docker-compose-dev.yml @@ -24,6 +24,7 @@ services: - ./envs/env environment: - MCT_VERSION=latest + - MCT_DEV_LIVERELOAD=1 # OIDC Settings - USE_OIDC=0 - KEYCLOAK_URL=http://keycloak.cogstack.localhost diff --git a/medcat-trainer/webapp/scripts/run.sh b/medcat-trainer/webapp/scripts/run.sh index 9e343148c..7aac9d002 100755 --- a/medcat-trainer/webapp/scripts/run.sh +++ b/medcat-trainer/webapp/scripts/run.sh @@ -45,4 +45,11 @@ fi # RESET any Env vars to original stat export RESUBMIT_ALL_ON_STARTUP=$TMP_RESUBMIT_ALL_VAR -exec uv run uwsgi --http-timeout 360s --http :8000 --master --chdir /home/api/ --module core.wsgi +# Dev live-reload: runserver restarts and re-imports on file change; uWSGI py-autoreload only restarts workers (old code in memory). +if [ ${MCT_DEV_LIVERELOAD:-0} -eq 1 ]; then + echo "Starting with Django runserver (live reload)" + cd /home/api + exec uv run python manage.py runserver 0.0.0.0:8000 +else + exec uv run uwsgi --http-timeout 360s --http :8000 --master --chdir /home/api/ --module core.wsgi +fi