(sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash A

(sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash A

在注册新用户的时候报错:

(sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash AS users_password_hash, users.confirmed AS users_confirmed

检查数据库的时候发现没有建立应该存在的两张表

这时候我们需要程序的shell

创建数据库

(sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash A

在执行完成db.create_all()之后

在查看数据库

(sqlite3.OperationalError) no such table: users [SQL: 'SELECT users.id AS users_id, users.email AS users_email, users.username AS users_username, users.role_id AS users_role_id, users.password_hash A

数据库中出现了我们需要的roles和users的table。

这时候我们的用户就能正常注册了。

于是我把这个错误记录下来,方便有同样错误的人查找问题。如果你碰到同样的问题欢迎和我联系,我们一起学习进步。。

上一篇:UITextView 监听 return key的改变


下一篇:MVC加载分布页的三种方式