From 7f222e0abf052e7d156d7c244174310dfd71989f Mon Sep 17 00:00:00 2001
From: Brian Moe <brian.moe@ligo.org>
Date: Tue, 20 Dec 2011 13:32:59 -0600
Subject: [PATCH] Updated database spec.  workaround for import repetition of
 mysql libs.

---
 settings.py     | 25 ++++++++++++++++++-------
 settings_dev.py | 28 ++++++++++++++++++++--------
 2 files changed, 38 insertions(+), 15 deletions(-)

diff --git a/settings.py b/settings.py
index 32772a49a..9a1a10798 100644
--- a/settings.py
+++ b/settings.py
@@ -1,6 +1,16 @@
 # Django settings for gracedb project.
 import os
 
+try:
+    # Workaround for a bug
+    # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473584
+    # http://bugs.python.org/setuptools/issue36
+    # import MySQLdb followed by import pkg_resources complains
+    #   /usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module _mysql was already imported from /usr/lib/pymodules/python2.6/_mysql.so, but /usr/lib/pymodules/python2.6 is being added to sys.path
+    import pkg_resources
+except:
+    pass
+
 DEBUG = False
 TEMPLATE_DEBUG = DEBUG
 
@@ -40,13 +50,14 @@ XMPP_ALERT_CHANNELS = [
                         'test_grb',
                       ]
 
-DATABASE_ENGINE = 'mysql'
-DATABASE_NAME = 'gracedb'
-DATABASE_USER = 'gracedb'
-DATABASE_PASSWORD = 'redrum4x'
-DATABASE_HOST = ''             # Set to empty string for localhost.
-DATABASE_PORT = ''             # Set to empty string for default.
-
+DATABASES = {
+    'default' : {
+        'NAME'     : 'gracedb',
+        'ENGINE'   : 'django.db.backends.mysql',
+        'USER'     : 'gracedb',
+        'PASSWORD' : 'redrum4x',
+    }
+}
 
 # SkyAlert
 
diff --git a/settings_dev.py b/settings_dev.py
index 21410556b..f6ced5ab8 100644
--- a/settings_dev.py
+++ b/settings_dev.py
@@ -1,5 +1,16 @@
 # Django settings for gracedb project.
 
+try:
+    # Workaround for a bug
+    # http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=473584
+    # http://bugs.python.org/setuptools/issue36
+    # import MySQLdb followed by import pkg_resources complains
+    #   /usr/lib/python2.6/dist-packages/pytz/__init__.py:32: UserWarning: Module _mysql was already imported from /usr/lib/pymodules/python2.6/_mysql.so, but /usr/lib/pymodules/python2.6 is being added to sys.path
+    import pkg_resources
+except:
+    pass
+
+
 DEBUG = True
 TEMPLATE_DEBUG = DEBUG
 
@@ -27,14 +38,15 @@ XMPP_ALERT_CHANNELS = [
                         'test_cwb',
                         'test_lowmass',
                       ]
-
-DATABASE_ENGINE = 'mysql'
-DATABASE_NAME = 'gracedb'
-DATABASE_USER = 'gracedb'
-DATABASE_PASSWORD = 'redrum4x'
-DATABASE_HOST = ''             # Set to empty string for localhost.
-DATABASE_PORT = ''             # Set to empty string for default.
-
+ 
+DATABASES = {
+    'default' : {
+        'NAME'     : 'gracedb',
+        'ENGINE'   : 'django.db.backends.mysql',
+        'USER'     : 'gracedb',
+        'PASSWORD' : 'redrum4x',
+    }
+}
 
 # SkyAlert
 
-- 
GitLab