2006-05-02 09:31:56 +08:00
|
|
|
from django.conf import settings
|
|
|
|
import os
|
|
|
|
|
|
|
|
def runshell():
|
2006-07-05 18:12:58 +08:00
|
|
|
args = ['psql']
|
|
|
|
if settings.DATABASE_USER:
|
|
|
|
args += ["-U", settings.DATABASE_USER]
|
2006-05-02 09:31:56 +08:00
|
|
|
if settings.DATABASE_PASSWORD:
|
|
|
|
args += ["-W"]
|
|
|
|
if settings.DATABASE_HOST:
|
2006-07-05 18:12:58 +08:00
|
|
|
args.extend(["-h", settings.DATABASE_HOST])
|
2006-05-02 09:31:56 +08:00
|
|
|
if settings.DATABASE_PORT:
|
2006-07-05 18:12:58 +08:00
|
|
|
args.extend(["-p", str(settings.DATABASE_PORT)])
|
2006-05-02 09:31:56 +08:00
|
|
|
args += [settings.DATABASE_NAME]
|
|
|
|
os.execvp('psql', args)
|