Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Fixed #18602 -- Improved error message when database NAME is missing

Thanks Kristian Glass for the report.
  • Loading branch information...
commit 828f7b62e8d29f796403606a797d7aec6da98647 1 parent d9db1d3
@claudep claudep authored
View
6 django/db/backends/postgresql_psycopg2/base.py
@@ -157,9 +157,11 @@ def _get_pg_version(self):
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'],
}
View
4 django/db/backends/sqlite3/base.py
@@ -250,7 +250,9 @@ def _sqlite_create_connection(self):
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,
Please sign in to comment.
Something went wrong with that request. Please try again.