""" WSGI entry point for running Server Monitor via Gunicorn. Gunicorn imports `app` from this module. Because Gunicorn bypasses the startup logic in main.py, this module also ensures the database tables exist (idempotent) so a fresh deployment works on first boot. """ import os from app import create_app from config.database_config import get_db app = create_app(os.environ.get('FLASK_ENV', 'production')) # Ensure database tables exist (idempotent: only creates missing tables). with app.app_context(): get_db().create_tables()