‘Flask‘ object has no attribute ‘record‘

服务启动报错:
![在这里插入图片描述](https://img-blog.csdnimg.cn/fee0d9c5a28f4bc5a201df9515c41b5b.pn

测试bug过程中发现只要不连接mongodb,服务即可以正常启动,功能模块也可以正常使用,只要连接mongodb启动服务过程中就报错,目前只参考https://stackoverflow.com/questions/60269631/flask-instance-does-not-have-attribute-record-error,目前还没有解决,请问有遇到过的吗?

def init_app(self, app, **kwargs):
    '''
    Allow to lazy register the API on a Flask application::

    >>> app = Flask(__name__)
    >>> api = Api()
    >>> api.init_app(app)

    :param flask.Flask app: the Flask application object
    :param str title: The API title (used in Swagger documentation)
    :param str description: The API description (used in Swagger documentation)
    :param str terms_url: The API terms page URL (used in Swagger documentation)
    :param str contact: A contact email for the API (used in Swagger documentation)
    :param str license: The license associated to the API (used in Swagger documentation)
    :param str license_url: The license page URL (used in Swagger documentation)

    '''
    self.app = app
    self.title = kwargs.get('title', self.title)
    self.description = kwargs.get('description', self.description)
    self.terms_url = kwargs.get('terms_url', self.terms_url)
    self.contact = kwargs.get('contact', self.contact)
    self.contact_url = kwargs.get('contact_url', self.contact_url)
    self.contact_email = kwargs.get('contact_email', self.contact_email)
    self.license = kwargs.get('license', self.license)
    self.license_url = kwargs.get('license_url', self.license_url)
    self._add_specs = kwargs.get('add_specs', True)

    # If app is a blueprint, defer the initialization
    try:
        app.record(self._deferred_blueprint_init)
    # Flask.Blueprint has a 'record' attribute, Flask.Api does not
    except AttributeError:
        self._init_app(app)
    else:
        self.blueprint = app

不确定是否与api.py中这部分代码有关系?

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值