diff options
author | Filipp Lepalaan <filipp@mac.com> | 2015-12-08 11:59:52 +0200 |
---|---|---|
committer | Filipp Lepalaan <filipp@mac.com> | 2015-12-08 11:59:52 +0200 |
commit | 938ca501a6192abe9e14b390c39163aa391415d1 (patch) | |
tree | d2463ff2b1607c46e90ab2a35416bb684bbea7b9 /servo/management/commands | |
parent | ed3448fe04dd357de8795be75fa3a4cc8940d41f (diff) | |
download | Servo-938ca501a6192abe9e14b390c39163aa391415d1.tar.gz Servo-938ca501a6192abe9e14b390c39163aa391415d1.tar.bz2 Servo-938ca501a6192abe9e14b390c39163aa391415d1.zip |
Use PATH from env
Diffstat (limited to 'servo/management/commands')
-rw-r--r-- | servo/management/commands/dbbackup.py | 8 |
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) |