在save()方法中调整sorl ImageField大小时出现IO错误 - 使用s3boto

时间:2014-09-26 22:36:01

标签: django django-models sorl-thumbnail django-storage

我有以下内容:

from sorl.thumbnail import ImageField, get_thumbnail

class MyMoldel(models.Model):   
    image = ImageField(uploat to = 'images')

    def save(self, *args, **kwargs):
        if self.image:
            self.image = get_thumbnail(self.image, '320x180', quality=90, format='PNG')
        super(BaseReward, self).save(*args, **kwargs)

我在上传和图片时遇到以下错误,并尝试在管理面板中保存:

OError at /admin/rewards/basereward/5/
File does not exist: Rewards Default.png
Request Method: POST
Request URL:    http://127.0.0.1:8000/admin/rewards/basereward/5/
Django Version: 1.6.5
Exception Type: IOError
Exception Value:    
File does not exist: Rewards Default.png
Exception Location: /Users/xyz/voltbe2/venv/lib/python2.7/site-packages/storages/backends/s3boto.py in _open, line 366

错误来了(我已经通过省略代码行来检查)来自尝试打开self.image的get_thumbnail。如何将其转换为s3boto路径以传递给get_thumbnail?

感谢

0 个答案:

没有答案