Question

I have a few apps set up, to one of which I just added a fixture. I created an "initial_data.yaml" file in a subdirectory "fixtures" under the app folder, so the full path is project_dir\apps\job\fixtures\initial_data.yaml.

I've tried both

python manage.py syncdb

and

python manage.py schemamigration job --auto

and both of them give me:

No fixtures found.

What am I doing wrong, here?

Was it helpful?

Solution

Do you install pyYAML ?

http://pyyaml.org/wiki/PyYAML

manage.py needs yaml-parser for load initial_data.yaml.

OTHER TIPS

Django documentation clearly states:

By default, Django looks in the fixtures directory inside each app for fixtures.

But I have found that it's not true. If You don't define FIXTURE_DIRS in settings.py, then django will look for initial_data.yaml in the same directory where manage.py and settings.py are. I had this issue with django 1.3.1.

You also need to have a python yaml parser installed or django will ignore fixtures in yaml format. If You are using Ubuntu, You can install the parser by issuing the following command in the console:

sudo apt-get install python-yaml

i think it needs to go in

/project/job/fixtures/

assuming your app is named job

Try the following and see how you go:

Dump your existing data, empty your DB and then try syncdb again (if you are happy to clear your DB):

python manage.py dumpdata
python manage.py syncdb

Does that work? If so, you have a 'blueprint' fixture file.

If not could you let us know which version of Django you are using?

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top