处理数据库,备份fix,端口改 5432

This commit is contained in:
Ivan Office
2024-10-09 17:00:33 +08:00
parent ac527565ee
commit 8b2b329dc2
3 changed files with 10 additions and 6 deletions

View File

@@ -27,9 +27,13 @@ class DbBackupDetails(models.Model):
}
def unlink(self):
if self.file_path:
if os.path.exists(self.file_path):
os.remove(self.file_path)
for rec in self:
try:
if rec.file_path:
if os.path.exists(rec.file_path):
os.remove(rec.file_path)
except Exception as e:
pass
return super(DbBackupDetails, self).unlink()
def action_remove_file(self):