summaryrefslogtreecommitdiff
path: root/django/db/backends/postgresql/client.py
diff options
context:
space:
mode:
authorAdrian Holovaty <adrian@holovaty.com>2006-04-13 04:35:00 +0000
committerAdrian Holovaty <adrian@holovaty.com>2006-04-13 04:35:00 +0000
commitb59d57e4d23698351d367c8f42d79ed2bc7c295a (patch)
treead3c0fc274f842dec7bce8b5f6aff0032fea3322 /django/db/backends/postgresql/client.py
parent47333f6d1e3086aa0fb7d0bddb888bea8fb76526 (diff)
magic-removal: Fixed #1631 -- Added 'django-admin.py dbshell' command, which runs the command-line client for your database engine with your connection settings. Thanks, Paul Bissex
git-svn-id: http://code.djangoproject.com/svn/django/branches/magic-removal@2693 bcc190cf-cafb-0310-a4f2-bffc1f526a37
Diffstat (limited to 'django/db/backends/postgresql/client.py')
-rw-r--r--django/db/backends/postgresql/client.py14
1 files changed, 14 insertions, 0 deletions
diff --git a/django/db/backends/postgresql/client.py b/django/db/backends/postgresql/client.py
new file mode 100644
index 0000000000..3d0d7a0d2a
--- /dev/null
+++ b/django/db/backends/postgresql/client.py
@@ -0,0 +1,14 @@
+from django.conf import settings
+import os
+
+def runshell():
+ args = ['']
+ args += ["-U%s" % settings.DATABASE_USER]
+ if settings.DATABASE_PASSWORD:
+ args += ["-W"]
+ if settings.DATABASE_HOST:
+ args += ["-h %s" % settings.DATABASE_HOST]
+ if settings.DATABASE_PORT:
+ args += ["-p %s" % settings.DATABASE_PORT]
+ args += [settings.DATABASE_NAME]
+ os.execvp('psql', args)