Merge pull request #17 from joelmathewthomas/feature/celery-env-config

Set env vars necessary for celery within celery config
This commit is contained in:
Joel Mathew Thomas
2025-01-11 03:07:28 +05:30
committed by GitHub
+11
View File
@@ -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.