From ab2970aa5a22b84a1dca1fe5f878c3af47254a70 Mon Sep 17 00:00:00 2001 From: david Date: Sun, 15 Mar 2026 18:24:34 +0300 Subject: [PATCH] add logs to backend dockerfile --- backend/app/__init__.py | 10 +++++----- backend/app/services/card_position_service.py | 2 +- docker/Dockerfile | 6 +++++- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/backend/app/__init__.py b/backend/app/__init__.py index 3d98468..3c726d0 100644 --- a/backend/app/__init__.py +++ b/backend/app/__init__.py @@ -1,4 +1,4 @@ -import json +# import json import os from dotenv import load_dotenv @@ -28,10 +28,10 @@ def create_app(config_name=None): app.config.from_object(config_by_name[config_name]) - print("----------------------------------------------------------") - print(f"------------------ENVIRONMENT: {config_name}-----------------------") - print(json.dumps(dict(app.config), indent=2, default=str)) - print("----------------------------------------------------------") + # print("----------------------------------------------------------") + # print(f"------------------ENVIRONMENT: {config_name}-----------------------") + # print(json.dumps(dict(app.config), indent=2, default=str)) + # print("----------------------------------------------------------") # Initialize extensions with app db.init_app(app) migrate.init_app(app, db) diff --git a/backend/app/services/card_position_service.py b/backend/app/services/card_position_service.py index 13eebf2..c9d60b1 100644 --- a/backend/app/services/card_position_service.py +++ b/backend/app/services/card_position_service.py @@ -78,7 +78,7 @@ class CardPositionService: for index, card in enumerate(dest_cards): if card is None: # This is where our moved card should go - moved_card = Card.query.get(moved_card_id) + moved_card = db.session.get(Card, moved_card_id) if moved_card: moved_card.pos = float(index) else: diff --git a/docker/Dockerfile b/docker/Dockerfile index e5d1ac6..fa2d5fb 100644 --- a/docker/Dockerfile +++ b/docker/Dockerfile @@ -43,4 +43,8 @@ EXPOSE 8000 # Run with Gunicorn (Production WSGI Server) # --bind 0.0.0.0 makes it accessible outside the container -CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "wsgi:app"] \ No newline at end of file +# --access-logfile - sends access logs to stdout +# --error-logfile - sends error logs to stderr +# --capture-output ensures all output is captured +# --log-level info sets the logging level +CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "--access-logfile", "-", "--error-logfile", "-", "--capture-output", "--log-level", "info", "wsgi:app"]