"""
Stock Locator — Production WSGI entry point
--------------------------------------------
Windows (production, no debug):
    waitress-serve --host=0.0.0.0 --port=5050 wsgi:app

Or just double-click START.bat — it calls this file automatically.
"""
import os
from app import app  # noqa: F401 — Flask instance exported for waitress

if __name__ == "__main__":
    port = int(os.environ.get("PORT", 5050))
    try:
        from waitress import serve
        print(f"[Stock Locator] Production server  http://0.0.0.0:{port}  (waitress)")
        serve(app, host="0.0.0.0", port=port, threads=4)
    except ImportError:
        print("[Stock Locator] WARNING: install waitress for production — pip install waitress")
        app.run(host="0.0.0.0", port=port, debug=False)
