views:

29

answers:

1

I have finally got my admin part of my django site working.

I am now beginning the tedious part of manually entering the initial data into the database. Obviously, I want this to be a one time affair.

Can anyone suggest to me how I can create fixtures data from my manually entered data, so that I can reload the data (automatically?) when I do a manage.py syncdb ?

A: 

Use the dumpdata management command.

python manage.py dumpdata yourappname > app_data.json
Daniel Roseman
@daniel: I did as you suggested, but I piped the output to appname/fixtures/myapp_data.json. When I run manage.py syncdb, it echoed "No fixtures found". So, I piped the dumped data to the project directory (like in your example), still, I got the same message: "No fixtures found". According to the docs, django looks in the app/fixtures folder (as part of its path), so its not clear what I'm doing wrong. Is there a specific command to load fixtures data?.
skyeagle
Sorry, slight misunderstanding. If you want the fixture to always be loaded on `syncdb`, you have to call it `initial_data.json`. See [the documentation](http://docs.djangoproject.com/en/dev/howto/initial-data/).
Daniel Roseman
@daniel: Thanks very much. I have all the info I need now. Thanks once again!
skyeagle