我目前正在使用通用图像生成缩略图,但是它引发了许多相同的错误,即使创建的模型实例不需要缩略图也无法生成缩略图。另外,django确实具有将映像写入C:\ Users \ jason \ Desktop \ staticfiles \ media_root'的权限。当我实际上传图像时,通用图像确实将图像和缩略图成功写入media_root。
以下是错误的示例:
Thumbnail generation failed
Traceback (most recent call last):
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\image_warmer.py", line 117, in _prewarm_versatileimagefield
url = get_url_from_image_key(versatileimagefieldfile, size_key)
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\utils.py", line 216, in get_url_from_image_key
img_url = img_url[size_key].url
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\sizedimage.py", line 149, in __getitem__
height=height
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\sizedimage.py", line 201, in create_resized_image
path_to_image
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\versatileimagefield\datastructures\base.py", line 140, in retrieve_image
image = self.storage.open(path_to_image, 'rb')
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\files\storage.py", line 33, in open
return self._open(name, mode)
File "C:\Users\jason\AppData\Local\Programs\Python\Python36\lib\site-packages\django\core\files\storage.py", line 218, in _open
return File(open(self.path(name), mode))
PermissionError: [Errno 13] Permission denied: 'C:\\Users\\jason\\Desktop\\staticfiles\\media_root'