Search code examples
pythondjangopython-3.xfixturesseeding

In Django, can you run seed data without always generating a migration?


I'm using Django and Python 3.7. I have created a YAML file with seed data for my db ...

./myapp/fixtures/seed_data.yaml

How do I run this without generating a new migration for it, as is specified here -- Loading initial data with Django 1.7 and data migrations ? I think theoretically there may be times when I add data to the file and my need to re-run it so it would be a little cumbersome to generate a new migration every time.


Solution

  • Migrations will only run once, as you already correctly noticed :)

    However, you can always manually run a ./manage.py loaddata <fixture>. Don't know if that's what you're looking for.