Question
- Why does Django automatically load the
initial_data.json
fixture when it's located inside the project directory but not located in one of the three specified locations that Django searches for fixtures?
Configuration Information
- I have not set the
FIXTURE_DIRS
setting in sett开发者_开发技巧ings.py - Django 1.2.1
Django's Documentation Regarding Fixture Locations
The What's a "Fixture" section of Django's django-admin.py and manage.py documentation states:
Django will search in three locations for fixtures:
- In the fixtures directory of every installed application
- In any directory named in the FIXTURE_DIRS setting
- In the literal path named by the fixture
Django will load any and all fixtures it finds in these locations that match the provided fixture names.
initial_data is actually behaviour belonging to syncdb. What you are citing is the default places loaddata will look for when queried. initial_data.json is detected by the syncdb option and passed to loaddata. I agree it's a bit confusing, but you are actually mixing general fixture loading behaviour (loaddata) with automatic fixture loading behaviour (syncdb).
Hope this helps.
精彩评论