load_initial_data.py 412 B

12345678910111213
  1. import os
  2. from django.conf import settings
  3. from django.core.management.base import BaseCommand
  4. from django.core.management import call_command
  5. class Command(BaseCommand):
  6. def handle(self, **options):
  7. fixtures_dir = os.path.join(settings.BASE_DIR, 'base', 'fixtures')
  8. fixture_file = os.path.join(fixtures_dir, 'bakerydemo.json')
  9. call_command('loaddata', fixture_file, verbosity=0)