mirror of
https://github.com/django/django.git
synced 2025-08-08 04:48:27 +00:00
db: Gave each DatabaseClient class an 'executable_name' attribute (e.g., 'psql' or 'mysql'), so that we can use it to make a more helpful error message. Refs #8978
git-svn-id: http://code.djangoproject.com/svn/django/trunk@8989 bcc190cf-cafb-0310-a4f2-bffc1f526a37
This commit is contained in:
parent
8f78d7f940
commit
42a878cfea
5 changed files with 21 additions and 9 deletions
|
@ -3,8 +3,10 @@ from django.conf import settings
|
|||
import os
|
||||
|
||||
class DatabaseClient(BaseDatabaseClient):
|
||||
executable_name = 'psql'
|
||||
|
||||
def runshell(self):
|
||||
args = ['psql']
|
||||
args = [self.executable_name]
|
||||
if settings.DATABASE_USER:
|
||||
args += ["-U", settings.DATABASE_USER]
|
||||
if settings.DATABASE_PASSWORD:
|
||||
|
@ -14,4 +16,4 @@ class DatabaseClient(BaseDatabaseClient):
|
|||
if settings.DATABASE_PORT:
|
||||
args.extend(["-p", str(settings.DATABASE_PORT)])
|
||||
args += [settings.DATABASE_NAME]
|
||||
os.execvp('psql', args)
|
||||
os.execvp(self.executable_name, args)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue