fix cache path

This commit is contained in:
jxxghp
2024-08-29 15:39:12 +08:00
parent f4dfaa0519
commit 264cd2658b
3 changed files with 7 additions and 3 deletions

View File

@@ -31,7 +31,7 @@ def douban_img(imgurl: str) -> Any:
# 获取Url中除域名外的路径
url_path = "/".join(imgurl.split('/')[3:])
# 生成缓存文件路径
cache_path = settings.TEMP_PATH / url_path
cache_path = settings.CACHE_PATH / 'images' / url_path
# 如果缓存文件不存在,下载图片并保存
if not cache_path.exists():
response = __download_image(imgurl)