我想生成用户上传到Django站点的附件的缩略图,但出于某种原因,我得到了以下错误:
FileNotFoundError: [Errno 2] No such file or directory: '/media/tenant-2cadb939-306a-43f2-aa53-eb086a4f74b9/AssignedCampaign/2021-2/53676e7d-c95d-4348-a_581e4TM.png'尽管文件确实存在。
这是我使用的代码:
if a.attachment:
# get path of attachment without the attachment name
cache_path = a.full_path.replace('/'+a.full_path.split('/')[-1], '') + '/preview_cache'
log.info('>>>>>>>>>> %s', cache_path)
preview_manager = PreviewManager(cache_path, create_folder=True)
preview = preview_manager.get_jpeg_preview(a.full_path, width=100, height=200)发布于 2021-02-16 10:55:14
我要做的是给出文件的绝对路径
https://stackoverflow.com/questions/66212352
复制相似问题