Tutorial :Django Fixtures Error: Unknown application



Question:

I have a project w/ multiple apps. I am attempting to use the dumpdata command to create a fixture for each app. Calling dumpdata on a given app seems to work well.

This prints the data to the console:

python manage.py dumpdata myapp  

However, when I attempt to create a json file containing the dumped data:

python manage.py dumpdata apps/myapp/fixtures/initial_data.json  

This error is thrown:

Error: Unknown application: apps/myapp/fixtures/initial_data  

The fixtures dir already exists and I've tried multiple variations of the path to the json file. There is another coder on the project and we are working with the same source code. He does not appear to be running into the same issue though.

We are using Django 1.2.


Solution:1

You give the correct syntax in your first snippet. The argument after dumpdata is an application, not a file.

If you want to save that output to a file, you use standard redirection:

python manage.py dumpdata myapp > apps/myapp/fixtures/initial_data.json  

Note:If u also have question or solution just comment us below or mail us on toontricks1994@gmail.com
Previous
Next Post »