import os
import sys

# 1. Calculate project base directory (the folder containing this file)
BASE_DIR = os.path.dirname(os.path.abspath(__file__))

# 2. Add BASE_DIR and the 'backend' folder to Python path
sys.path.insert(0, BASE_DIR)
sys.path.insert(0, os.path.join(BASE_DIR, 'backend'))

# 3. Set Django settings module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings')

# 4. Import and expose the WSGI application
from django.core.wsgi import get_wsgi_application
application = get_wsgi_application()