0

What is the right way to load initial users in Django 1.10?

When we talk about our own django app then it is recommended to have a /fixtures/initial_data.json (as mentioned here).

But in the case of User, where django.contrib.auth is not our app, where should we put the fixtures directory and how do we load it?

Thank you,

Rami

Community
  • 1
  • 1
user3139774
  • 1,295
  • 3
  • 13
  • 24

1 Answers1

1

You can create fixture from default user model by below command:

python manage.py dumpdata auth.user -o FIXTURE_ADDRESS

and load initial data by below command:

python manage.py loaddata FIXTURENAME

that FIXTURENAME is name of your fixture in one of FIXTURE_DIRS. The FIXTURE_DIRS by default is fixtures.