Closed giohappy closed 1 month ago
Two more tasks here, that can be implemented later:
ASSETS_FOLDER
) and unmanaged files. If Assets with unmanaged files are present, they should at least be logged as warning, since the restores assets may not work if the unmanaged files are not found.ASSETS_FOLDER
is different than the source one, the root of the file's location
should be replaced.Restoring assets_root
will be done in the future, now it migh raise other issues related to the heuristic replace.
A possible solution is to save the original .env
file during the backup and access it during the restore.
A possible heuristic solutions could be the following:
logger.info("*** Update Assets path...")
for instance in LocalAsset.objects.iterator():
should_be_updated = any(settings.ASSETS_ROOT not in loc for loc in instance.location)
if should_be_updated:
new_assets = []
for loc in instance.location:
if settings.ASSETS_ROOT not in loc:
new_assets.append(loc.replace(os.path.dirname(os.path.dirname(loc)), ttings.ASSETS_ROOT))
else:
new_assets.append(loc)
instance.location = new_assets
instance.save()
logger.info("*** Assets path updated...")
The assets (
ASSETS_FOLDER
) folder must be part of the B/R. The logic will be the same as for the media folder. DRY, transform the logic in a common method, bot for the backup and restore.