Anonymous avatar Anonymous committed 9ee859e

Fix #163: Allow database adapters for South that aren't under "south.db.dbname".

Comments (0)

Files changed (1)

south/db/__init__.py

 # This code somewhat lifted from django evolution
 from django.conf import settings
 import sys
-module_name = ['south.db', settings.DATABASE_ENGINE]
+if hasattr(settings, "SOUTH_DATABASE_ADAPTER"):
+    module_name = settings.SOUTH_DATABASE_ADAPTER
+else:
+    module_name = '.'.join(['south.db', settings.DATABASE_ENGINE])
+
 try:
-    module = __import__('.'.join(module_name),{},{},[''])
+    module = __import__(module_name,{},{},[''])
 except ImportError:
-    sys.stderr.write("There is no South database module for the engine '%s'. Please either choose a supported one, or remove South from INSTALLED_APPS.\n" % settings.DATABASE_ENGINE)
+    sys.stderr.write("There is no South database module for the engine '%s' (tried with %s). Please either choose a supported one, or check for SOUTH_DATABASE_ADAPTER settings, or remove South from INSTALLED_APPS.\n" 
+                     % (settings.DATABASE_ENGINE, module_name))
     sys.exit(1)
-db = module.DatabaseOperations()
+db = module.DatabaseOperations()
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.