# Import database settings from a default file (so we can keep those out
# of git).
from dbsettings import *
+# Import alternative database settings for when running a south schema
+# migration. The soutsettings.py takes care of detecting this case and
+# prompting for a password, then.
+from southsettings import *
# Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name
--- /dev/null
+# Database settings for when doing a database migration using south,
+# which requires more privileges.
+
+import sys
+if 'manage.py' in sys.argv[0] and sys.argv[1] == 'migrate':
+ import south
+
+ try:
+ # We cache the prompted values in the south module, since the
+ # settings module gets loaded multiple times...
+ DATABASE_USER = south.cached_db_user
+ DATABASE_PASSWORD = south.cached_db_pw
+ except AttributeError:
+ DATABASE_USER = raw_input("Privileged database user: ")
+ DATABASE_PASSWORD = raw_input("Database password for %s: " % DATABASE_USER)
+ south.cached_db_user = DATABASE_USER
+ south.cached_db_pw = DATABASE_PASSWORD