TaleLin / lin-cms-flask

🎀A simple and practical CMS implememted by Flask
http://doc.cms.talelin.com/
Other
832 stars 216 forks source link

Werkzeug 版本更新导致openapi.json打开失败 #218

Closed grassroadsZ closed 2 years ago

grassroadsZ commented 2 years ago

windwos 上按照文档进行启动 。点击“心上无垢”,将跳转到Redoc页面;此时会报错

127.0.0.1 - - [26/Jul/2022 17:28:21] "GET /apidoc/openapi.json HTTP/1.1" 500 -
Traceback (most recent call last):
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 2091, in __call__
    return self.wsgi_app(environ, start_response)
  File "e:\code\flask_admin\venv\lib\site-packages\flask_socketio\__init__.py", line 43, in __call__
    return super(_SocketIOMiddleware, self).__call__(environ,
  File "e:\code\flask_admin\venv\lib\site-packages\engineio\middleware.py", line 74, in __call__
    return self.wsgi_app(environ, start_response)
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 2076, in wsgi_app
    response = self.handle_exception(e)
  File "e:\code\flask_admin\venv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 2073, in wsgi_app
    response = self.full_dispatch_request()
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 1518, in full_dispatch_request
    rv = self.handle_user_exception(e)
  File "e:\code\flask_admin\venv\lib\site-packages\flask_cors\extension.py", line 165, in wrapped_function
    return cors_after_request(app.make_response(f(*args, **kwargs)))
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 1393, in handle_user_exception
    return self.ensure_sync(handler)(e)
  File "e:\code\flask_admin\venv\lib\site-packages\lin\lin.py", line 172, in handler
    raise e
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 1516, in full_dispatch_request
    rv = self.dispatch_request()
  File "e:\code\flask_admin\venv\lib\site-packages\flask\app.py", line 1502, in dispatch_request
    return self.ensure_sync(self.view_functions[rule.endpoint])(**req.view_args)
  File "e:\code\flask_admin\venv\lib\site-packages\spectree\plugins\flask_plugin.py", line 213, in <lambda>
    view_func=lambda: jsonify(self.spectree.spec),
  File "e:\code\flask_admin\venv\lib\site-packages\spectree\spec.py", line 80, in spec
    self._spec = self._generate_spec()
  File "e:\code\flask_admin\venv\lib\site-packages\spectree\spec.py", line 241, in _generate_spec
    path, parameters = self.backend.parse_path(
  File "e:\code\flask_admin\venv\lib\site-packages\spectree\plugins\flask_plugin.py", line 58, in parse_path
    from werkzeug.routing import parse_converter_args, parse_rule
ImportError: cannot import name 'parse_rule' from 'werkzeug.routing' (e:\code\flask_admin\venv\lib\site-packages\werkzeug\routing\__init__.py)

原因:直接安装依赖文件时 Werkzeug 的版本是三天前的 2.2.0 ,将 Werkzeug 降级为 2.1.2 ,问题解决