I'm having a problem when trying to add objects to my database in my app. I just deployed this app and it's working on my local installation, where I'm using sqlite. On my webfaction deployment, I'm using postgre. I get the following error:
It seems that I have not been able to create the database properly. I'm able to add users in my admin and register new users from my django app, but I keep getting this "foreign key constraint" error when trying to add other objects that require users as a foreign key. In the phpPgAdmin, there are no rows in flow_user, so apparently it's not correctly creating the users? I'm using south for migrations which might have created an error? Is there something I might need to do change in my models to get my django app working in postgre after using sqlite? Any ideas how to correct this error, recreate the database or why this error has arised? asked 05 Jan '11, 05:42 Rrr8 |
The error basically says that there is data missing from your database. The most straightforward way to deal with this would be to dump the data from your old application (using the "manage.py dumpdata"), and then load the data to your new application (using "manage.py loaddata"). You can learn more about the dumpdata/loaddata commands at: http://docs.djangoproject.com/en/dev/ref/django-admin/#dumpdata-appname-appname-appname-model answered 05 Jan '11, 06:07 tie |