Fix 502 after update: safe startup, single DB init, healthcheck

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
2026-06-06 22:58:09 +03:00
parent 82fdb60f5e
commit 5353c82066
10 changed files with 107 additions and 52 deletions
+9
View File
@@ -25,6 +25,15 @@ from app.upload_service import process_uploads
bp = Blueprint("main", __name__)
@bp.route("/health")
def health():
try:
db.session.execute(db.text("SELECT 1"))
return {"status": "ok"}, 200
except Exception as exc:
return {"status": "error", "detail": str(exc)}, 503
@bp.route("/")
def index():
photos = Photo.query.order_by(Photo.created_at.desc()).limit(24).all()