Django ImageField 验证&太平洋石油公司
周日,当我安装 stackless 时,我遇到了 python 模块的问题 Python。现在我已经编译并安装了:
setuptools & python-mysqldb 和我的 django 项目启动并运行 再次。 (我还重新安装了django-1.1),
然后我编译安装了,jpeg,freetype2和PIL。我也开始了 使用 mod_wsgi 而不是 mod_python。
但是,当以表单上传图像字段时,我收到验证错误:
上传有效图像。您上传的文件要么不是图像,要么 损坏的图像。
Searchmonkey显示它来自field.py imagefield验证。 在引发此错误之前,它从 PIL 导入图像,打开文件并 验证它。我尝试从 python 提示符手动导入 PIL - 它 工作得很好。与 Image.open 和 Image.verify 相同。 那么什么可能导致这个问题呢?
艾伦
On sunday, I had problems with python modules, when I installed stackless
python. Now I have compiled and installed :
setuptools & python-mysqldb and i got my django project up and running
again. (i also reinstalled django-1.1),
Then I compiled and installed, jpeg, freetype2 and PIL. I also started
using mod_wsgi instead of mod_python.
But when uploading imagefield in form I get validationerror:
Upload a valid image. The file you uploaded was either not an image or
a corrupted image.
Searchmonkey shows that it comes from field.py imagefield validation.
before raising this error it imports Image from PIL, opens file and
verfies it. I tried importing PIL from python prompt manually - it
worked just fine. Same with Image.open and Image.verify.
So what could be causing this problem?
Alan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
可能想查看这篇博文,看看它是否能解决您的问题。
http://www .chipx86.com/blog/2008/07/25/django-tips-pil-imagefield-and-unit-tests/
Might want to check out this blog post and see if it addresses your problem.
http://www.chipx86.com/blog/2008/07/25/django-tips-pil-imagefield-and-unit-tests/