Reputation: 2888
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?
Upvotes: 2
Views: 2857
Reputation: 3852
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
Upvotes: 1
Reputation: 36
Do you install pyYAML ?
manage.py needs yaml-parser for load initial_data.yaml.
Upvotes: 2
Reputation: 270
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?
Upvotes: 0
Reputation: 22329
i think it needs to go in
/project/job/fixtures/
assuming your app is named job
Upvotes: 0