""" Celery worker entry point. This script is used to start Celery workers and provides the proper Flask context. """ import os # Create Flask app (don't export it at module level to avoid conflicts with Celery) from app import create_app _flask_app = create_app(os.getenv("FLASK_ENV", "development")) # Import and initialize Celery with Flask app context from app.celery import celery # Celery is now configured and ready with Flask app context # Workers will use this instance and have access to Flask extensions (db, etc.) if __name__ == "__main__": # This allows running the worker directly if needed print("Celery worker entry point initialized") print(f"Flask app created: {_flask_app.name}") print(f"Celery broker: {celery.conf.broker_url}") print(f"Celery backend: {celery.conf.result_backend}")