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

时间:2022-04-06 19:18:33

I am getting this error when I run this code: NameError: name 'request' is not defined

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

This is my code

这是我的代码

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 个解决方案

#1


0  

You don't import request

您不导入请求

from flask import request

来自烧瓶进口申请

#1


0  

You don't import request

您不导入请求

from flask import request

来自烧瓶进口申请