Skip to content

Instantly share code, notes, and snippets.

@SophieShears
Last active March 11, 2026 19:55
Show Gist options
  • Select an option

  • Save SophieShears/0eaf1ec98af2117480976ee978c994db to your computer and use it in GitHub Desktop.

Select an option

Save SophieShears/0eaf1ec98af2117480976ee978c994db to your computer and use it in GitHub Desktop.
change download file_path from url to absolute path
from submissions.models import *
dl_ids = list(Download.objects.filter(file_path__contains='https://', service__in=['SC', 'IS', 'IH']).values_list('id', flat=True))
for dl_id in dl_ids:
download = Download.objects.get(id=dl_id)
split_filepath = download.file_path.split('insta_rw')
after_filepath = f'/mnt/storage47-1/layer_1400_vids/instagram_stories/videos{split_filepath[-1]}'
download.file_path = after_filepath
download.save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment