aboutsummaryrefslogtreecommitdiffstats
path: root/servo/management/commands
diff options
context:
space:
mode:
Diffstat (limited to 'servo/management/commands')
-rw-r--r--servo/management/commands/dbbackup.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/servo/management/commands/dbbackup.py b/servo/management/commands/dbbackup.py
index af253a1..350c7ab 100644
--- a/servo/management/commands/dbbackup.py
+++ b/servo/management/commands/dbbackup.py
@@ -14,7 +14,9 @@ class Command(BaseCommand):
def handle(self, *args, **options):
db = settings.DATABASES['default']
fn = '%s_%s.pgdump' % (db['NAME'], strftime('%Y%m%d_%H%I'))
+ if not os.path.exists(settings.BACKUP_DIR):
+ os.mkdir(settings.BACKUP_DIR)
fn = os.path.join(settings.BACKUP_DIR, fn)
-
- subprocess.call(['/Applications/Postgres.app/Contents/Versions/9.3/bin/pg_dump', '-Fc', db['NAME'], '-U', db['USER'],
- '-f' , fn], env={'PGPASSWORD': db['PASSWORD']})
+ env = {'PATH': os.getenv('PATH'), 'PGPASSWORD': db['PASSWORD']}
+ subprocess.call(['pg_dump', '-Fc', db['NAME'], '-U',
+ db['USER'], '-f' , fn], env=env)