On 3/14/07, Jens Diemer <[EMAIL PROTECTED]> wrote:
>
> Here some information: I'm rewrite PyLucid CMS: http://www.pylucid.org
> The emphasis is thereby: Using PyLucid in a shared Webhosting
> environment. So I implement a complete Web-Based installation.
>
> I write a "init DB data" routine:

First off, for clarification - you're not using the Django native
fixtures. The Cookbook code your code is based off is not the same as
the Django fixtures that are documented as part of the test framework.

> The source fixture file is a dump from a MySQL DB.

As a warning - using MySQL will cause you some problems with the
serializers. MySQL doesn't support forward references if you use the
InnoDB backend, and it doesn't support row-referential integrity or
transactions if you use the MyISAM backend.

> The current fixture file, can you see here:
> http://pylucid.net/trac/browser/branches/0.8%28django%29/PyLucid/fixtures/initial_data.xml?rev=925&format=raw

Ok; the error you reported previously (app_label, model not unique) is
being caused when deserializing the contenttype model in the
contenttypes application. This model requires that the fields
app_label and model are a unique pair. The error will be generated
either because:

1) your data file contains a duplicate entry, or
2) you aren't flushing the existing data before inserting the new
data, so when you deserialize, you are duplicating data in the
database.

> I have some open questions: How am I to store the data?
> I tried:
>         - file(fixture_filename, "w")
>         - file(fixture_filename, "wb")
>         - codecs.open(fixture_filename, "w", "utf-8")
> (reading accordingly)

You will need to read the file in the same mode as which it was
written, but other than that, the answer depends entirely on what you
are saving. In your case, you have unicode characters in your data, so
using unicode files would be appropriate.

Yours,
Russ Magee %-)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to