import sys
import os

# 1. Tell Python where your application files are located
sys.path.insert(0, os.path.dirname(__file__))

# 2. Import the WSGI adapter we installed via requirements.txt
from a2wsgi import ASGIMiddleware

# 3. Import your actual FastAPI instance from main.py
from main import app

# 4. Wrap the ASGI app so Phusion Passenger can read it as WSGI
#    Passenger specifically looks for a variable named 'application'
application = ASGIMiddleware(app)