I'm having trouble getting django to read my fixture file. I created it in yaml:
- model: cdsem.fields
pk: 1
fields:
name: data_file_id
description: data_file_id
- model: cdsem.fields
pk: 2
fields:
name: tool_id
description: tool_id
and so on.
I put it in a file called initial_data.yaml in the fixtures dir of my
app. When I run syncdb it does not pick it up. FIXTURE_DIRS was not
set. I should not have to set it, but I did anyway, but it still did
not pick up the file. If I run loaddata and give it the path to the
file I get:
Problem installing fixture './fixtures/initial_data': yaml is not a
known serialization format.
The docs say yaml is supported. What am I doing wrong?
On Thu, Oct 4, 2012 at 10:36 AM, Jonathan Baker
<[email protected]> wrote:
> You're welcome. Personally, I've found it's easiest to get the JSON
> formatted correctly by creating the model, syncing the DB, inserting some
> dummy records, running 'dumpdata' against the table, and then copying the
> printed JSON into initial_data.json so that next time you build your data is
> all there.
>
>
> On Thu, Oct 4, 2012 at 10:31 AM, Larry Martell <[email protected]>
> wrote:
>>
>> Thanks! I knew there had to be a way!
>>
>> On Thu, Oct 4, 2012 at 10:28 AM, Jonathan Baker
>> <[email protected]> wrote:
>> > initial_data sounds like what you're looking for:
>> > https://docs.djangoproject.com/en/dev/howto/initial-data/
>> >
>> > On Thu, Oct 4, 2012 at 10:26 AM, Larry Martell <[email protected]>
>> > wrote:
>> >>
>> >> Is there some way to use manage.py to create a table and load data
>> >> into it (where the data is contained in the models.py)?
>> >>
>> >> I have a client that wants to have some data contained in the code (so
>> >> it's part of the code repository), and when they do the initial
>> >> syncdb, have that data loaded into one of the tables. Is anything like
>> >> this supported in django?
>> >>
>> >> --
>> >> 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.
>> >>
>> >
>> >
>> >
>> > --
>> > Jonathan D. Baker
>> > Developer
>> > http://jonathandbaker.com
>> >
>> > --
>> > 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.
>>
>> --
>> 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.
>>
>
>
>
> --
> Jonathan D. Baker
> Developer
> http://jonathandbaker.com
>
> --
> 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.
--
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.