migrate_1.py 362 B

123456789
  1. def upload(path, filename):
  2. path_file = '%s/%s'%(BASE, filename)
  3. if COMMON_PATH in path_file:
  4. path_upload = ROOT_PATH + path_file.rsplit(COMMON_PATH, 1)[1]
  5. print (' Upload to : %s' % path_upload)
  6. key = Key(bucket, path_upload)
  7. key.set_contents_from_filename(path_file)
  8. else:
  9. print (' Upload path not found.')