From 4be1dfa46f5e9a15414540af1235212c71da05a5 Mon Sep 17 00:00:00 2001 From: JoaquinBN Date: Wed, 21 Jan 2026 15:30:50 +0100 Subject: [PATCH 1/2] Fix stale Python bytecode causing old logs in Docker images Prevent cached .pyc files from executing old code by: - Excluding all nested __pycache__ directories in .dockerignore - Removing .pyc files explicitly during Docker build This fixes the issue where old print statements continued appearing despite deploying new code without print statements. --- backend/.dockerignore | 3 ++- backend/Dockerfile | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/backend/.dockerignore b/backend/.dockerignore index 03ae3bec..bf231a5f 100644 --- a/backend/.dockerignore +++ b/backend/.dockerignore @@ -1,4 +1,5 @@ -# Python +# Python - exclude ALL __pycache__ directories (not just root level) +**/__pycache__/ __pycache__/ *.py[cod] *$py.class diff --git a/backend/Dockerfile b/backend/Dockerfile index 079f0347..09e37f91 100644 --- a/backend/Dockerfile +++ b/backend/Dockerfile @@ -22,6 +22,11 @@ RUN pip install --no-cache-dir -r requirements.txt # Copy project COPY . . +# Remove any cached Python bytecode that might have been copied +# This ensures fresh .py files are always used +RUN find . -type d -name "__pycache__" -exec rm -rf {} + 2>/dev/null || true +RUN find . -name "*.pyc" -delete 2>/dev/null || true + # Make startup script executable RUN chmod +x startup.sh From 8a17b629d9b229e21ccbdd6877d4edca65d26a84 Mon Sep 17 00:00:00 2001 From: JoaquinBN <47780609+JoaquinBN@users.noreply.github.com> Date: Wed, 21 Jan 2026 22:21:40 +0700 Subject: [PATCH 2/2] removal cron sync token var --- backend/deploy-apprunner-dev.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/backend/deploy-apprunner-dev.sh b/backend/deploy-apprunner-dev.sh index 7298cc29..4d9bec03 100755 --- a/backend/deploy-apprunner-dev.sh +++ b/backend/deploy-apprunner-dev.sh @@ -72,8 +72,7 @@ if aws apprunner describe-service --service-arn arn:aws:apprunner:$REGION:$ACCOU "GITHUB_ENCRYPTION_KEY": "$SSM_PREFIX/$SSM_ENV/github_encryption_key", "GITHUB_REPO_TO_STAR": "$SSM_PREFIX/$SSM_ENV/github_repo_to_star", "RECAPTCHA_PUBLIC_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_public_key", - "RECAPTCHA_PRIVATE_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_private_key", - "CRON_SYNC_TOKEN": "$SSM_PREFIX/$SSM_ENV/cron_sync_token" + "RECAPTCHA_PRIVATE_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_private_key" }, "StartCommand": "./startup.sh gunicorn --bind 0.0.0.0:8000 --timeout 180 --workers 2 tally.wsgi:application" }, @@ -228,8 +227,7 @@ EOF "GITHUB_ENCRYPTION_KEY": "$SSM_PREFIX/$SSM_ENV/github_encryption_key", "GITHUB_REPO_TO_STAR": "$SSM_PREFIX/$SSM_ENV/github_repo_to_star", "RECAPTCHA_PUBLIC_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_public_key", - "RECAPTCHA_PRIVATE_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_private_key", - "CRON_SYNC_TOKEN": "$SSM_PREFIX/$SSM_ENV/cron_sync_token" + "RECAPTCHA_PRIVATE_KEY": "$SSM_PREFIX/$SSM_ENV/recaptcha_private_key" }, "StartCommand": "./startup.sh gunicorn --bind 0.0.0.0:8000 --timeout 180 --workers 2 tally.wsgi:application" },