使用Flask模块时候,运行报错
AttributeError: module 'queue' has no attribute 'Queue'
自己代码部分
from flask import Flask
from flask_restx import Resource,Api
app = Flask(__name__)
api = Api(app)
@api.route('/demo')
class Demo(Resource):
def get(self):
return {"code":200,"msg":"get success"}
def post(self):
return {"code": 200, "msg": "get success"}
if __name__ == '__main__':
app.run(debug=True)
解决办法:
1.查看网上说有可能与debug模式有关,那去掉debug模式就可以正常运行了
2.后来发现当前项目下有一个自己建的文件名字为queue.py,把文件名字修改了即可。
即为存在debug模式也可以正常运行的