无法创建user表
来源:9-9 ORM的方式保存模型
kryo
2019-03-30
在register页面输入用户名、邮件地址、密码后点击提交,页面抛出如下错误,同时在navicat上只有一个book表,无法创建user表:
sqlalchemy.exc.ProgrammingError sqlalchemy.exc.ProgrammingError: (cymysql.err.ProgrammingError) (1146, “Table ‘fisher.user’ doesn’t exist”) [SQL: SELECT user.password AS user_password, user.id AS user_id, user.nickname AS user_nickname, user.phone_number AS user_phone_number, user.email AS user_email, user.confirmed AS user_confirmed, user.beans AS user_beans, user.send_counter AS user_send_counter, user.receive_counter AS user_receive_counter, user.wx_open_id AS user_wx_open_id, user.wx_name AS user_wx_name FROM user WHERE user.email = %s LIMIT %s] [parameters: (‘s@sin.com’, 1)] (Background on this error at: http://sqlalche.me/e/f405)
1回答
-
kryo
提问者
2019-03-30
经历千辛万苦,比较老师4-19的代码,才找到问题所在:
models/book.py中的db的import的语句没有从原来的
db = SQLAlchemy()
改为:
from app.models.base import db
012019-03-30
相似问题