报错内容
Traceback (most recent call last):
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/cli.py", line 83, in find_best_app
app = call_factory(script_info, app_factory)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/cli.py", line 119, in call_factory
return app_factory()
File "/root/flask/todoism/todoism/__init__.py", line 41, in create_app
register_blueprints(app)
File "/root/flask/todoism/todoism/__init__.py", line 63, in register_blueprints
app.register_blueprint(api_v1, url_prefix='/api/v1')
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/app.py", line 98, in wrapper_func
return f(self, *args, **kwargs)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/app.py", line 1167, in register_blueprint
blueprint.register(self, options, first_registration)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/blueprints.py", line 256, in register
deferred(state)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/blueprints.py", line 222, in wrapper
func(state)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/blueprints.py", line 553, in <lambda>
lambda s: s.app._register_error_handler(self.name, code_or_exception, f)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/app.py", line 98, in wrapper_func
return f(self, *args, **kwargs)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/app.py", line 1420, in _register_error_handler
exc_class, code = self._get_exc_class_and_code(code_or_exception)
File "/root/.local/share/virtualenvs/todoism-VPre3nLT/lib/python3.5/site-packages/flask/app.py", line 1351, in _get_exc_class_and_code
assert issubclass(exc_class, Exception)
TypeError: issubclass() arg 1 must be a class
相关部分代码(代码是从书上照着写的,自己没有改写)。
63行代码
# 注册蓝本
def register_blueprints(app):
app.register_blueprint(auth_bp) # 认证蓝本
app.register_blueprint(todo_bp) # 程序蓝本
app.register_blueprint(home_bp) # 主页蓝本
app.register_blueprint(api_v1, url_prefix='/api/v1')
# 注册api_v1蓝本,URL前缀的形式访问Web API
41行代码
def create_app(config_name=None):
if config_name is None:
config_name = os.getenv('FLASK_CONFIG', 'development')
app = Flask('todoism')
app.config.from_object(config[config_name])
register_extensions(app)
register_blueprints(app)
register_commands(app)
register_errors(app)
register_template_context(app)
return app
帮忙看下,是什么问题,错误提示。
TypeError: issubclass() arg 1 must be a class
必须是个类?
浏览器打开截图