我正在使用 django-imagekit 处理上传图片,我遇到了以下错误:
AttributeError at /car/7/
'cStringIO.StringO' object has no attribute 'fileno'
Request Method: GET
Request URL: http://luxingnan.azurewebsites.net/car/7/
Django Version: 1.8
Exception Type: AttributeError
Exception Value:
'cStringIO.StringO' object has no attribute 'fileno'
Exception Location: D:\home\site\wwwroot\env\Lib\site-packages\pilkit\utils.py in
__enter__, line 248
Python Executable: D:\Python27\python.exe
Python Version: 2.7.8
Python Path:
[u'D:\\home\\site\\wwwroot\\env\\Lib\\site-packages', '.', 'D:\\Windows\\SYSTEM32\\python27.zip', 'D:\\Python27\\DLLs', 'D:\\Python27\\lib', 'D:\\Python27\\lib\\plat-win', 'D:\\Python27\\lib\\lib-tk', 'D:\\Python27', 'D:\\Python27\\lib\\site-packages', 'D:\\home\\site\\wwwroot']
Server time: Thu, 16 Apr 2015 12:28:26 +0000
下面是我的代码:
# models.py
class Carpic(models.Model):
picture = models.ImageField('pic',upload_to='car-pictures')
picture_slide = ImageSpecField(source='picture',
processors=[ResizeToFill(762, 456)],
format='JPEG',
options={'quality': 60}
)
# template.html
{% for pic in pictures %}
<li><img src="{{pic.picture_slide.url}}"/></li>
{% endfor %}
有人可以告诉我该怎么做吗?谢谢