如何使用Celery和Flask请求POST PUT方法?

时间:2018-07-23 18:44:24

标签: python flask celery

运行此代码时出现此错误:   NameError:名称“ request”未定义

这是我的代码

from app import app
from app import celery


@app.route("/name_async", methods=["POST"])
def name_call_async():
    name.delay()
    return 'async request'

@celery.task(name='run.name')
def name():
    a = request.form.get('NAME')
    return a

1 个答案:

答案 0 :(得分:0)

您不导入request

from flask import request