import os
import sys

# Add the current directory to the system path
sys.path.insert(0, os.path.dirname(__file__))

# Import the Flask app from wsgi.py and rename it to 'application'
# This is what Phusion Passenger (cPanel) expects as the entry point
try:
    from wsgi import app as application
except Exception as e:
    # Log error if import fails (helpful for debugging on cPanel)
    with open('error_log.txt', 'a') as f:
        f.write(f"Startup Error: {str(e)}\n")
    raise
