summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaude Paroz <claude@2xlibre.net>2012-07-10 13:22:55 +0200
committerClaude Paroz <claude@2xlibre.net>2012-07-10 13:22:55 +0200
commit828f7b62e8d29f796403606a797d7aec6da98647 (patch)
treedcbb111188be956c90ddfe764dae471ddbd5a559
parentd9db1d3373e9bee37258d7f6b50bea80c767a28c (diff)
Fixed #18602 -- Improved error message when database NAME is missing
Thanks Kristian Glass for the report.
-rw-r--r--django/db/backends/postgresql_psycopg2/base.py6
-rw-r--r--django/db/backends/sqlite3/base.py4
2 files changed, 7 insertions, 3 deletions
diff --git a/django/db/backends/postgresql_psycopg2/base.py b/django/db/backends/postgresql_psycopg2/base.py
index 61be680d83..f76b91ddd6 100644
--- a/django/db/backends/postgresql_psycopg2/base.py
+++ b/django/db/backends/postgresql_psycopg2/base.py
@@ -157,9 +157,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
def _cursor(self):
settings_dict = self.settings_dict
if self.connection is None:
- if settings_dict['NAME'] == '':
+ if not settings_dict['NAME']:
from django.core.exceptions import ImproperlyConfigured
- raise ImproperlyConfigured("You need to specify NAME in your Django settings file.")
+ raise ImproperlyConfigured(
+ "settings.DATABASES is improperly configured. "
+ "Please supply the NAME value.")
conn_params = {
'database': settings_dict['NAME'],
}
diff --git a/django/db/backends/sqlite3/base.py b/django/db/backends/sqlite3/base.py
index c59905b29a..d7f51605d5 100644
--- a/django/db/backends/sqlite3/base.py
+++ b/django/db/backends/sqlite3/base.py
@@ -250,7 +250,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
settings_dict = self.settings_dict
if not settings_dict['NAME']:
from django.core.exceptions import ImproperlyConfigured
- raise ImproperlyConfigured("Please fill out the database NAME in the settings module before using the database.")
+ raise ImproperlyConfigured(
+ "settings.DATABASES is improperly configured. "
+ "Please supply the NAME value.")
kwargs = {
'database': settings_dict['NAME'],
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,