2

尝试使用 Flasgger 查看 Swagger UI 时收到此错误消息:

 ERROR in app: Exception on /apispec_1.json [GET]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 2446, in wsgi_app
    response = self.full_dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1951, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "/usr/local/lib/python3.6/site-packages/flask_cors/extension.py", line 161, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1820, in handle_user_exception
    reraise(exc_type, exc_value, tb)
  File "/usr/local/lib/python3.6/site-packages/flask/_compat.py", line 39, in reraise
    raise value
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1949, in full_dispatch_request
    rv = self.dispatch_request()
  File "/usr/local/lib/python3.6/site-packages/flask/app.py", line 1935, in dispatch_request
    return self.view_functions[rule.endpoint](**req.view_args)
  File "/usr/local/lib/python3.6/site-packages/flask/views.py", line 89, in view
    return self.dispatch_request(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flask/views.py", line 163, in dispatch_request
    return meth(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/flasgger/base.py", line 133, in get
    return jsonify(self.loader())
  File "/usr/local/lib/python3.6/site-packages/flasgger/base.py", line 465, in get_apispecs
    prefix_ids=prefix_ids
  File "/usr/local/lib/python3.6/site-packages/flasgger/utils.py", line 747, in extract_definitions
    if not getattr(item, 'get'):
AttributeError: 'NoneType' object has no attribute 'get'

我尝试了一切,但是当我访问 http://localhost:5000/apidocs 时我什么也看不到。我收到错误消息:获取错误:内部服务器错误 /apispec_1.json

4

0 回答 0