pythondjangogitfixturesdjango-syncdb

python manage.py syncdb does not automatically load initial_data.json fixture in Python Django


I have Python Django project with app at apps/hello and a fixture with initial data at /apps/hello/fixtures/initial_data.json

When I git clone my Python Django project from github, checkout needed branch and run

./manage.py syncdb

it creates empty tables with no content i. e. does not load data from my initial_data fixture. Django asks me to register a superuser which is already registered in fixture.

Operations to perform:
  Apply all migrations: admin, contenttypes, hello, auth, sessions
Running migrations:
  Applying contenttypes.0001_initial... OK
  Applying auth.0001_initial... OK
  Applying admin.0001_initial... OK
  Applying hello.0001_initial... OK
  Applying hello.0002_auto_20141217_1326... OK
  Applying hello.0003_auto_20141217_1329... OK
  Applying sessions.0001_initial... OK
You have installed Django's auth system, and don't have any superusers defined.
Would you like to create one now? (yes/no): no

However I can steel load data manually

./manage.py loaddata apps/hello/fixtures/initial_data.json

Installed 12 object(s) from 1 fixture(s)

How to make Django do the same thing automatically on syncdb?


Solution

  • I had the same problem, and I solved it by adding a few lines in my settings.py

    FIXTURE_DIRS = (
        os.path.join(BASE_DIR, 'hello/fixtures'),
    )