Почему задача не планируется, а ожидается ее выполнение при проходе на страницу "/test_task"?
from flask import Flask
App = Flask(__name__)
from celery import Celery
App.config['CELERY_BROKER_URL'] = 'redis://127.0.0.1:6379/0'
App.config['CELERY_RESULT_BACKEND'] = 'redis://127.0.0.1:6379/0'
celery = Celery(App.name, broker=App.config['CELERY_BROKER_URL'])
celery.conf.update(App.config)
@celery.task
def task_print_msg(counter):
for i in range(counter):
print('+ +', i*10, '+ +')
@App.route('/test_task', methods=['GET'])
def test_task():
print('=== test_task ===')
for i in range(100000):
print('send', i)
task_print_msg(i)
return jsonify({'status': True})