"""
wsgi.py — WSGI entry point for gunicorn.

gunicorn (production):
    cd /var/www/html/togen
    gunicorn wsgi:application --bind 0.0.0.0:5001 --workers 2 --timeout 120
"""

import os
import sys
from pathlib import Path

# Add togen dir and the qr dir (where qr_merge.py lives) to the path
_HERE = Path(__file__).resolve().parent
_QR_DIR = Path('/var/www/html/qr')
sys.path.insert(0, str(_HERE))
sys.path.insert(0, str(_QR_DIR))

os.environ.setdefault('QR_WATCH_DIR', '/var/www/html/qr')
os.environ.setdefault('QR_BASE_URL', 'https://togen.icastinc.com')

from app import app as application  # noqa: E402 — must come after path setup
