Conditionally configure MySQL as a database backend.

Even though SQLite is the default, Django tries to import MySQLdb,
which on OS X is challenging to install.

(imported from commit 0947c86e5e9a1fbf2ff8d74b78f297ff939ff712)
This commit is contained in:
Jessica McKellar 2012-09-14 16:29:53 -04:00
parent 2fb626c106
commit 6ccbab9bf5
1 changed files with 9 additions and 3 deletions

View File

@ -22,13 +22,19 @@ DATABASES = {
'timeout': 20, 'timeout': 20,
}, },
}, },
'mysql': { }
try:
import MySQLdb
except ImportError:
pass
else:
DATABASES['mysql'] = {
'ENGINE': 'django.db.backends.mysql', 'ENGINE': 'django.db.backends.mysql',
'OPTIONS': { 'OPTIONS': {
'read_default_file': '/etc/mysql/my.cnf', 'read_default_file': '/etc/mysql/my.cnf',
}, },
}, }
}
# Local time zone for this installation. Choices can be found here: # Local time zone for this installation. Choices can be found here:
# http://en.wikipedia.org/wiki/List_of_tz_zones_by_name # http://en.wikipedia.org/wiki/List_of_tz_zones_by_name