问题描述
我想要能够在amazon s3中存储文件。 mongoengine中的FileField似乎被gridfs硬编码。
I want to be able to store files in amazon s3. The FileField in mongoengine seems to be hardcoded with gridfs.
我可以做些什么来实现这一点?
What can I do to achieve this?
是有一个自定义的文件夹,就像常规的django FileField一样?
Is there a custom filefield out there, that behaves like the regular django FileField?
推荐答案
我没有看到一个S3 FileField用于MongoEngine - 所以目前,你必须滚动自己的实现 - 你可以使用一个 StringField
存储位置,或者你可以创建自己的 proxy_class
像 ImageField
,但它是相当的GridFs,但我很高兴抽象,如果需要。
I havent seen an S3 FileField for use with MongoEngine - so currently, you'd have to roll your own implementation - you could use a StringField
to store the location or you could create your own proxy_class
like ImageField
but it is quite tided to GridFs but I'm happy to abstract that away if needed.
一如往常拉请求欢迎!
As always pull requests welcome! https://github.com/MongoEngine/mongoengine
这篇关于将文件上传到DEFAULT_FILE_STORAGE而不是使用mongoengine的GridF的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!