I'm currently working on a project where I use a legacy database with a django one.
I've setup the multi database support and it seems to work pretty well.
However, I'm getting an issue with testing.
I need a fixture to load data to both the legacy and Django's databases.
In order to make this work, I found that I needed to set the multi_db to True in my TestCase (otherwise the legacy database data aren't loaded).
However, if I do that, it turns out that Django will throw an exception complaining about django_site not existing on my legacy database and would stop tests.
I also noticed some weird behavior with the initial data.
My initial_data load fine while the test framework works on the django database but it will complains about corrupted file while creating the legacy database (whether or not my testcase has the mult_db set).
Has someone a pointer or ideas on how to solve those issues ?
Esp the django_site thing which just blocks any test.
Regards,
Xavier.
I suspect that this might be an artefact of #14025. The flush command
was being a little too exuberant about the post-syncdb signals it was
emitting; since sites are created by a post-syncdb signal, and
overenthusiastic post-syncdb signal could be causing problems.
I've fixed the problem with flush in r13466 (and fixed the fix in
r13472); can you try a trunk checkout and let me know if it solves
your problem?
> I also noticed some weird behavior with the initial data.
> My initial_data load fine while the test framework works on the django database but it will complains about corrupted file while creating the legacy database (whether or not my testcase has the mult_db set).
Can you show the error message? I can't say this rings any bells for me.
Yours,
Russ Magee %-)
Indeed, my investigations have lead me to #14025 which fixed the major issue.
If I remember correctly the corrupted file part was due to the fact that I was still using an "old style" fixture filename - ie <name>.json instead of <name>.<database name>.json with data on both databases.
If you find it useful, I can investigate further about this message and make a patch in order to output an appropriate message.
Regards,
Xavier.
> --
> You received this message because you are subscribed to the Google Groups "Django users" group.
> To post to this group, send email to django...@googlegroups.com.
> To unsubscribe from this group, send email to django-users...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/django-users?hl=en.
>
"Old style" fixture names should still be valid -- if a database name
isn't specified, the fixture will be loaded on all available
databases. If you've got a test case where this fails, it should be
reported.
Yours,
Russ Magee %-)
I opened #14068.
I can not think of an easy fix as those I would choose will have side effects on other multi database settings.
If the core team can come with a design decision on the fix, I'll be happy to implement it.
Regards,
Xavier.