"""
passenger_wsgi.py — Entry point for cPanel Passenger / Python App.
=================================================================
cPanel's "Setup Python App" feature looks for this file in the project root.
It activates the virtual environment and hands Django's WSGI application
to the Passenger web server.

Steps to use:
  1. In cPanel → "Setup Python App", set:
       Application root  : /home/<your_cpanel_user>/your-domain.com
       Application URL   : your-domain.com
       Application entry : passenger_wsgi.py
       Python version    : 3.x (match your server's Python)
  2. Click "Create" or "Save".
  3. cPanel will create a virtual environment automatically.
  4. Use the cPanel terminal or SSH to run:
         pip install -r requirements.txt
         python manage.py migrate
         python manage.py collectstatic --noinput
"""
import sys
import os
from pathlib import Path

# ---------------------------------------------------------------------------
# Add the project root to Python's path so Django can be imported.
# ---------------------------------------------------------------------------
BASE_DIR = Path(__file__).resolve().parent
if str(BASE_DIR) not in sys.path:
    sys.path.insert(0, str(BASE_DIR))

# ---------------------------------------------------------------------------
# Tell Django which settings module to use.
# ---------------------------------------------------------------------------
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')

# ---------------------------------------------------------------------------
# Get Django's WSGI application — Passenger will call this.
# ---------------------------------------------------------------------------
from django.core.wsgi import get_wsgi_application   # noqa: E402
application = get_wsgi_application()
