Fixed #18602 -- Improved error message when database NAME is missing
Thanks Kristian Glass for the report.
This commit is contained in:
parent
d9db1d3373
commit
828f7b62e8
|
@ -157,9 +157,11 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
def _cursor(self):
|
def _cursor(self):
|
||||||
settings_dict = self.settings_dict
|
settings_dict = self.settings_dict
|
||||||
if self.connection is None:
|
if self.connection is None:
|
||||||
if settings_dict['NAME'] == '':
|
if not settings_dict['NAME']:
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
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 = {
|
conn_params = {
|
||||||
'database': settings_dict['NAME'],
|
'database': settings_dict['NAME'],
|
||||||
}
|
}
|
||||||
|
|
|
@ -250,7 +250,9 @@ class DatabaseWrapper(BaseDatabaseWrapper):
|
||||||
settings_dict = self.settings_dict
|
settings_dict = self.settings_dict
|
||||||
if not settings_dict['NAME']:
|
if not settings_dict['NAME']:
|
||||||
from django.core.exceptions import ImproperlyConfigured
|
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 = {
|
kwargs = {
|
||||||
'database': settings_dict['NAME'],
|
'database': settings_dict['NAME'],
|
||||||
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,
|
'detect_types': Database.PARSE_DECLTYPES | Database.PARSE_COLNAMES,
|
||||||
|
|
Loading…
Reference in New Issue