#!/usr/bin/env python3 """ Production server script for Email Alerts Application Runs on port 5237 and accessible over the internet """ from app import app import threading import time from datetime import datetime import logging # Configure logging logging.basicConfig( level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s', handlers=[ logging.FileHandler('email_alerts.log'), logging.StreamHandler() ] ) def auto_process_emails(): """Background function to automatically process emails""" from app import auto_process_emails as auto_process auto_process() if __name__ == '__main__': # Start auto-processing thread auto_thread = threading.Thread(target=auto_process_emails, daemon=True) auto_thread.start() logging.info("🔄 Auto-processing thread started") # Run the Flask app in production mode logging.info("🚀 Starting Email Alerts server on port 5237") logging.info("🌐 Server will be accessible at: http://104.225.217.215:5237") app.run( host='0.0.0.0', # Listen on all interfaces port=5237, # Your specified port debug=False, # Disable debug mode for production threaded=True # Enable threading for better performance )