def save_backup(self, request): from cmsutils.db_utils import do_backupdb from merengue.utils import save_backupdb zip_name = 'backup_%s' % datetime.now().isoformat('-') response = HttpResponse(mimetype='application/x-zip-compressed') response['Content-Disposition'] = 'attachment; filename="%s.zip"' % zip_name path_backup = do_backupdb() buffer_zip = save_backupdb(path_backup) response.write(buffer_zip.getvalue()) return response
def save_backup(self, request): from cmsutils.db_utils import do_backupdb from merengue.utils import save_backupdb zip_name = 'backup_%s' % datetime.now().isoformat('-') response = HttpResponse(mimetype='application/x-zip-compressed') response[ 'Content-Disposition'] = 'attachment; filename="%s.zip"' % zip_name path_backup = do_backupdb() buffer_zip = save_backupdb(path_backup) response.write(buffer_zip.getvalue()) return response
def handle(self, *args, **options): try: backup_dir = settings.BACKUP_DIR except AttributeError: backup_dir = 'backups' do_backupdb(backup_dir=backup_dir, updatelink=options.get('updatelink', False))