def backup():
 backup_file = 'outfile.sql.gz'
 with cd(BACKUP_DIR):
  run('PGPASSWORD={passwd} pg_dump -U {user} {database} | gzip > {backup}'.format(passwd=PG_PASSWORD, user=PG_USERNAME, database=PG_DATABASE, backup=backup_file))
  get(backup_file, 'backups/%(basename)s')

def backup ( ) : backup_file = 'outfile.sql.gz' with cd ( BACKUP_DIR ) : run ( 'PGPASSWORD={passwd} pg_dump -U {user} {database} | gzip > {backup}' . format ( passwd = PG_PASSWORD , user = PG_USERNAME , database = PG_DATABASE , backup = backup_file ) ) get ( backup_file , 'backups/%(basename)s' )
back up database locally todo: send backups to s3 .