Answer the question
In order to leave comments, you need to log in
Why is celery background task not working?
Hello. The celery background task is not working (my print is missing). What could be the problem? radish server started
from flask import Flask
from flask_socketio import SocketIO
from celery import Celery
app = Flask(__name__, static_url_path="", static_folder='/')
app.config['SECRET_KEY'] = 'gjr39dkjn344_!67#'
app.config['CELERY_BROKER_URL'] = 'redis://127.0.0.1:6379/'
app.config['CELERY_RESULT_BACKEND'] = 'redis://127.0.0.1:6379/'
celery = Celery(app.name, broker=app.config['CELERY_BROKER_URL'])
celery.conf.update(app.config)
@celery.task()
async def my_background_task():
print("work")
return "sss"
@app.route("/")
async def main():
task = my_background_task.delay()
print(task)
return "sss"
app.run()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question