from fastapi import FastAPI from celery import Celery app = FastAPI() BROKER_URL = 'redis://139.59.127.180:6379/0' BACKEND_URL = 'redis://139.59.127.180:6379/0' celery = Celery( __name__, broker=BROKER_URL, backend=BACKEND_URL ) @app.get("/") async def root(): return {"message": "Hello World"} @celery.task def divide(x, y): import time time.sleep(5) return x / y