diff --git a/api/celery_app.py b/api/celery_app.py index 12ffede..a557171 100644 --- a/api/celery_app.py +++ b/api/celery_app.py @@ -1,5 +1,16 @@ +import os +import sys from celery import Celery +# Automatically set environment variables in celery_app.py + +# Set Django settings module +os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'backend.settings') + +# Add the project directory to sys.path (similar to the manual PYTHONPATH) +project_root = os.path.abspath(os.path.join(os.path.dirname(__file__), '..')) +sys.path.append(project_root) + app = Celery('backend') # Load configuration from Django settings, using the CELERY namespace.