fastapi_celery/app/core/celery_app.py
2025-12-25 16:43:26 +08:00

19 lines
413 B
Python

from celery import Celery
from app.core.config import settings
celery_app = Celery(
"fastapi_celery_example",
broker=settings.celery_broker_url,
backend=settings.celery_result_backend,
include=["app.tasks.tasks"],
)
# Optional configuration
celery_app.conf.update(
task_serializer="json",
accept_content=["json"],
result_serializer="json",
timezone="UTC",
enable_utc=True,
)