From 938ca501a6192abe9e14b390c39163aa391415d1 Mon Sep 17 00:00:00 2001 From: Filipp Lepalaan Date: Tue, 8 Dec 2015 11:59:52 +0200 Subject: Use PATH from env --- servo/management/commands/dbbackup.py | 8 +++++--- 1 file 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) -- cgit v1.2.3