Programmatically using Django’s loaddata

Each django-admin.py (manage.py) command, as seen in the documentation, you can call from your code with:

from django.core.management import call_command

call_command('loaddata', 'myapp')

Where first param is the command name, all other position params are the same as command line position params and all keyword params are options.

Leave a Comment