Reputation: 2163
Is there a way to load fixtures that do NOT reside in appname/fixtures? According to django docs, fixtures have to be in directory of INSTALLED_APPS
Upvotes: 4
Views: 398
Reputation: 25154
You can define additional locations to search for fixtures using the FIXTURE_DIRS
setting: https://docs.djangoproject.com/en/dev/ref/settings/#std:setting-FIXTURE_DIRS
Upvotes: 4
Reputation: 2163
Just had to programmatically call 'loaddata' using call_command. You can do it in setUp.
from django.test import TestCase
from django.core.management import call_command
class GlobalSetup(TestCase):
def setUp(self):
# Manually calling loaddata to import fixures
# that are not in INSTALLED_APPS
call_command('loaddata', 'cur_dir/fixtures_name', verbosity=0)
Upvotes: 1