# This monkey-patching is crucial for eventlet/gevent to work correctly. # It must be done at the very top, before any other modules are imported. import eventlet eventlet.monkey_patch() # Import basic modules only import os import sys # Add current directory to Python path sys.path.insert(0, os.path.dirname(os.path.abspath(__file__))) from dotenv import load_dotenv # Load environment variables BEFORE creating the app load_dotenv() from app import create_app from celery_app import celery app = create_app() app.app_context().push()