Programmatically using Django loaddata

I would like to name the manage.py loaddata equivalent from the Django view. I would like to indicate where to download the data and which application to download it.

Any ideas?

+31
django
May 20, '09 at 12:29
source share
1 answer

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

 from django.core.management import call_command call_command('loaddata', 'myapp') 

If the first parameter is the command name, all other position parameters are the same as the command line parameters, and all keyword parameters are parameters.

+51
May 20 '09 at
source share