diff options
| author | Adrian Holovaty <adrian@holovaty.com> | 2005-07-16 22:21:50 +0000 |
|---|---|---|
| committer | Adrian Holovaty <adrian@holovaty.com> | 2005-07-16 22:21:50 +0000 |
| commit | 1e0fb3b7a3250a96869d598526be285e6f2a4fcd (patch) | |
| tree | 0601058d9d13cb67e33b5a53370df1094a05ebc6 | |
| parent | b9ec05d4c03d111fb2846645fc12a9bb0d361388 (diff) | |
Added helpful error message if DATABASE_NAME or DATABASE_USER is blank for postgresql
git-svn-id: http://code.djangoproject.com/svn/django/trunk@122 bcc190cf-cafb-0310-a4f2-bffc1f526a37
| -rw-r--r-- | django/core/db/backends/postgresql.py | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/django/core/db/backends/postgresql.py b/django/core/db/backends/postgresql.py index cf7c152f67..8de25f0d57 100644 --- a/django/core/db/backends/postgresql.py +++ b/django/core/db/backends/postgresql.py @@ -17,7 +17,9 @@ class DatabaseWrapper: def cursor(self): from django.conf.settings import DATABASE_USER, DATABASE_NAME, DATABASE_HOST, DATABASE_PASSWORD, DEBUG, TIME_ZONE if self.connection is None: - # Note that "host=" has to be last, because it might be blank. + if DATABASE_NAME == '' or DATABASE_USER == '': + from django.core.exceptions import ImproperlyConfigured + raise ImproperlyConfigured, "You need to specify both DATABASE_NAME and DATABASE_USER in your Django settings file." conn_string = "user=%s dbname=%s" % (DATABASE_USER, DATABASE_NAME) if DATABASE_PASSWORD: conn_string += " password=%s" % DATABASE_PASSWORD |
