import sys
import os

# 1. Add your project directory to the sys.path
# Change 'your_project_folder' to the actual path where main.py lives
sys.path.insert(0, os.path.dirname(__file__))

# 2. Import the adapter
from a2wsgi import ASGIMiddleware

# 3. Import your FastAPI app
# If your file is main.py and the instance is app = FastAPI()
from main import app as fastapi_app

# 4. Wrap the app - THIS IS THE CRITICAL FIX
# Passenger looks for a variable named 'application' by default
application = ASGIMiddleware(fastapi_app)
