- changed status to resolved
IntegrityError at /accounts/invite/
Hi,
I just installed the invitation app (latest from bitbucket). I did a python manage.py syncdb to add the two invitation tables to my MySQL db. I also followed instructions on updates to settings.py and url.py.
Not sure if I need other preliminary steps, but I don't think so. I can provide the entire stack trace if that is useful, please email me directly at nara19 (yahoo or gmail).
I'd appreciate a fast response, since I am blocked on this. See rest of report for details.
Thanks Nara
When I go to accounts/invite, or try to run a script that initially provides a few invites to each user, I get this error:
IntegrityError at /accounts/invite/
(1452, 'Cannot add or update a child row: a foreign key constraint fails (`juglr`.`invitation_invitationuser`, CONSTRAINT `inviter_id_refs_id_3bdeeb07` FOREIGN KEY (`inviter_id`) REFERENCES `auth_user` (`id`))')
Request Method: GET Request URL: http://nara:8000/accounts/invite/ Django Version: 1.4c2 Exception Type: IntegrityError Exception Value:
(1452, 'Cannot add or update a child row: a foreign key constraint fails (`juglr`.`invitation_invitationuser`, CONSTRAINT `inviter_id_refs_id_3bdeeb07` FOREIGN KEY (`inviter_id`) REFERENCES `auth_user` (`id`))')
Exception Location: /home/nara/virtualenvs/d3/local/lib/python2.7/site-packages/MySQLdb/connections.py in defaulterrorhandler, line 36 Python Executable: /home/nara/virtualenvs/d3/bin/python Python Version: 2.7.3
Comments (2)
-
Nara Narasimhan
-
Nara Narasimhan
Hi,
the problem was that just the invitation tables were being created as INNODB, whereas the rest of my entire database was in MYISAM. (By the way, I use south, but south is used only for my own apps)
I had to delete the tables (I use PHPMyAdmin for MySQL), add this line to settings:
DATABASES = { 'default': { ... 'OPTIONS' : { 'init_command' : 'SET storage_engine=MYISAM', }, } } and run syncdb again. This resolved the issue.
I got a clue about this from here: http://stackoverflow.com/questions/5269810/explicitly-set-mysql-table-storage-engine-using-south-and-django
Thanks Nara
- Log in to comment »