import os os.makedirs(os.path.join(os.path.dirname(__file__), "instance"), exist_ok=True) from app import app, db, seed_admin # Initialize DB - safe for multi-worker gunicorn with app.app_context(): try: db.create_all() seed_admin() except Exception as e: print(f"[wsgi] DB init: {e} (likely race condition with another worker, safe to ignore)")