【发布时间】:2010-11-18 21:52:02
【问题描述】:
按照 http://mongoengine.org/docs/v0.4/guide/gridfs.html 关于 mongoengine FileField 的文档,我做了以下事情:
在我的模型中
files = ListField(FileField())
在我的测试代码中
# Create an entry
photo = FileField()
f = open('/home/foo/marmot.jpg', 'r')
photo.put(f, content_type='image/jpeg')
entry.files = [photo,]
尝试关注文档,但出现错误:
Traceback (most recent call last):
File "/home/bar/tests.py", line 76, in test_MongoDGACLogook_creation
photo.put(f, content_type='image/jpeg')
AttributeError: 'FileField' object has no attribute 'put'
我是否遗漏了一些明显的东西?
谢谢
【问题讨论】:
标签: python mongodb gridfs mongoengine