python - Django can't flush database during tests -
when trying run tests (python manage.py test) getting:
commanderror: database test_db couldn't flushed. possible reasons: * database isn't running or isn't configured correctly. * @ least 1 of expected database tables doesn't exist. * sql invalid. hint: @ output of 'django-admin.py sqlflush'. that's sql command wasn't able run. full error: cannot truncate table referenced in foreign key constraint detail: table "install_location_2015_05_13" references "app". hint: truncate table "install_location_2015_05_13" @ same time, or use truncate ... cascade.
i using partitions in our project generated on fly via python function (so can run periodically). don't have models these partitions.
the partition maintenance function invoked after syncdb triggers post_syncdb signal (so executed when test database set up).
how can make django clear additional tables (partitions)? or how can tell django use cascade while running tests?
mainly problem occur change relation in m2m field. old constraint remain , new constraint new relation created. fixed in django 1.8
Comments
Post a Comment