我正在尝试将 mysql 与我的 web2py 应用程序连接:主屏幕即将出现,但在注册时出现以下错误:
<class 'gluon.contrib.pymysql.err.IntegrityError'> (1452, u'Cannot add or update a child row: a foreign key constraint fails (`911_signin`.`auth_membership`, CONSTRAINT `auth_membership_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `auth_user` (`id`) ON DELETE CASCADE)')
在此之前,我使用的是 sqlite,一切正常,因为它在 auth 表中显示错误,我无法做任何事情。(身份验证表是在应用程序中预定义的,所以我的代码中肯定有一些错误,但是我该如何调试或从这里继续呢?)
我尝试通过将dict(foreign_key_checks = 0)传递给adapter_args来暂时禁用外键,但我仍然遇到同样的错误。
当我尝试使用 cpdb.py 将数据从 sqlite 传输到 mysql 时,使用:
python cpdb.py -f ../applications/911_signin/databases -y sqlite://storage.sqlite -Y mysql://user:pass@127.0.0.1/db -d ../gluon
我收到以下错误:
EXCEPTION: could not make a copy of the database
'Cannot resolve reference auth_group in auth_permission definition'
传输数据目前是第二要务,参考错误我该怎么办?