# eventlet monkey-patching MUST happen before any other imports. # Without this, eventlet cannot patch the standard library's socket/threading # modules, which causes [Errno 9] Bad file descriptor errors under gunicorn # and makes SMTP connections unreliable in background threads. import eventlet eventlet.monkey_patch() import os from app import create_app, socketio app = create_app(os.environ.get('FLASK_ENV', 'production')) if __name__ == '__main__': socketio.run(app, host='0.0.0.0', port=5500, debug=app.debug)