[damned-lies] Fix remaining old DATABASE_ references



commit 0475cd229fb3082f27192ec84447cd97c56f9ed1
Author: Claude Paroz <claude 2xlibre net>
Date:   Thu Jan 20 21:47:56 2011 +0100

    Fix remaining old DATABASE_ references

 README          |   22 +++++++++++++++-------
 stats/models.py |    2 +-
 2 files changed, 16 insertions(+), 8 deletions(-)
---
diff --git a/README b/README
index fbc5552..3b5b6dc 100644
--- a/README
+++ b/README
@@ -95,8 +95,9 @@ performances.
 PostgreSQL
 ----------
 
-You just need to define DATABASE_ENGINE = 'postgresql_psycopg2' and
-DATABASE_NAME. Leave DATABASE_HOST setting empty to use UDS.
+In the DATABASES['default'] dictionary, you just need to define
+ENGINE = 'django.db.backends.postgresql_psycopg2' and the NAME key.
+Leave HOST setting empty to use UDS.
 
 MySQL
 -----
@@ -107,11 +108,18 @@ database bla charset=utf8;'
 
 In settings.py:
 
-DATABASE_HOST = '/var/run/mysqld/mysqld.sock'
-
-DATABASE_OPTIONS = {
-    'read_default_file': '/etc/mysql/my.cnf',
-    "init_command": "SET storage_engine=INNODB"
+DATABASES = {
+    'default' {
+        'ENGINE': 'django.db.backends.mysql',
+        'NAME': '<your database name>',
+        'USER': '<your user>',
+        'PASSWORD': '<your password>',
+        'HOST' = '/var/run/mysqld/mysqld.sock',
+        'OPTIONS' = {
+            'read_default_file': '/etc/mysql/my.cnf',
+            'init_command': 'SET storage_engine=INNODB'
+        }
+    }
 }
 
 Grep for ANSI_QUOTES in the source code to find the models.py which
diff --git a/stats/models.py b/stats/models.py
index fc3c751..14fbe6d 100644
--- a/stats/models.py
+++ b/stats/models.py
@@ -875,7 +875,7 @@ class Release(models.Model):
               AND stat.language_id IS NULL
             GROUP BY domain.dtype"""
         cursor = connection.cursor()
-        if settings.DATABASE_ENGINE == 'mysql':
+        if settings.DATABASES['default']['ENGINE'].endswith('mysql'):
             cursor.execute("SET sql_mode='ANSI_QUOTES'")
         cursor.execute(query, (self.id,))
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]