add logs to backend dockerfile

This commit is contained in:
david 2026-03-15 18:24:34 +03:00
parent 0e714b8ca1
commit ab2970aa5a
3 changed files with 11 additions and 7 deletions

View file

@ -1,4 +1,4 @@
import json # import json
import os import os
from dotenv import load_dotenv from dotenv import load_dotenv
@ -28,10 +28,10 @@ def create_app(config_name=None):
app.config.from_object(config_by_name[config_name]) app.config.from_object(config_by_name[config_name])
print("----------------------------------------------------------") # print("----------------------------------------------------------")
print(f"------------------ENVIRONMENT: {config_name}-----------------------") # print(f"------------------ENVIRONMENT: {config_name}-----------------------")
print(json.dumps(dict(app.config), indent=2, default=str)) # print(json.dumps(dict(app.config), indent=2, default=str))
print("----------------------------------------------------------") # print("----------------------------------------------------------")
# Initialize extensions with app # Initialize extensions with app
db.init_app(app) db.init_app(app)
migrate.init_app(app, db) migrate.init_app(app, db)

View file

@ -78,7 +78,7 @@ class CardPositionService:
for index, card in enumerate(dest_cards): for index, card in enumerate(dest_cards):
if card is None: if card is None:
# This is where our moved card should go # 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: if moved_card:
moved_card.pos = float(index) moved_card.pos = float(index)
else: else:

View file

@ -43,4 +43,8 @@ EXPOSE 8000
# Run with Gunicorn (Production WSGI Server) # Run with Gunicorn (Production WSGI Server)
# --bind 0.0.0.0 makes it accessible outside the container # --bind 0.0.0.0 makes it accessible outside the container
CMD ["gunicorn", "--bind", "0.0.0.0:8000", "--workers", "2", "wsgi:app"] # --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"]