Commits

Dmitri Lebedev committed 01a21f3

automatically search fixture directories

Comments (0)

Files changed (2)

 DATABASES = {
 	'default': {
 		'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-		'NAME': 'development.sqlite3',					  # Or path to database file if using sqlite3.
-		'USER': '',					  # Not used with sqlite3.
+		'NAME': os.path.join(PROJECT_ROOT, '..', 'dev.sqlite3'),  # Or path to database file if using sqlite3.		'USER': '',					  # Not used with sqlite3.
 		'PASSWORD': '',				  # Not used with sqlite3.
 		'HOST': '',					  # Set to empty string for localhost. Not used with sqlite3.
 		'PORT': '',					  # Set to empty string for default. Not used with sqlite3.
 	}
 }
 
-FIXTURE_DIRS = (
-	'project/apps/main/fixtures_dev',
+folder_name = 'fixtures_%s' % __file__.replace('.py', '')
+
+FIXTURE_DIRS = tuple(
+	os.path.join(root, folder_name)
+		for root, dirnames, filenames in os.walk('project/apps')
+			if folder_name in dirnames
 )
 DATABASES = {
 	'default': {
 		'ENGINE': 'django.db.backends.sqlite3', # Add 'postgresql_psycopg2', 'postgresql', 'mysql', 'sqlite3' or 'oracle'.
-		'NAME': 'production.sqlite3',					  # Or path to database file if using sqlite3.
+		'NAME': os.path.join(PROJECT_ROOT, '..', 'prod.sqlite3'),  # Or path to database file if using sqlite3.
 		'USER': '',					  # Not used with sqlite3.
 		'PASSWORD': '',				  # Not used with sqlite3.
 		'HOST': '',					  # Set to empty string for localhost. Not used with sqlite3.
 	}
 }
 
-FIXTURE_DIRS = (
-	'project/apps/main/fixtures_prod',
-)
+import os
+
+folder_name = 'fixtures_%s' % __file__.replace('.py', '')
+
+FIXTURE_DIRS = tuple(
+	os.path.join(root, folder_name)
+		for root, dirnames, filenames in os.walk('project/apps')
+			if folder_name in dirnames
+)