简体   繁体   English

使用mongoengine将文件上传到DEFAULT_FILE_STORAGE而不是GridFs

[英]Upload files to DEFAULT_FILE_STORAGE instead of GridFs with mongoengine

I want to be able to store files in amazon s3. 我希望能够在Amazon S3中存储文件。 The FileField in mongoengine seems to be hardcoded with gridfs. mongoengine中的FileField似乎使用gridfs进行了硬编码。

What can I do to achieve this? 我该怎么做?

Is there a custom filefield out there, that behaves like the regular django FileField? 是否有一个自定义文件字段,其行为类似于常规的Django FileField?

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. 我还没有看到一个S3的FileField与MongoEngine使用-所以目前,你必须推出自己的实现-你可以使用一个StringField存储位置,或者你可以创建自己的proxy_class喜欢ImageField但它是相当渡过到GridFS的,但如果需要,我很乐意将其抽象化。

As always pull requests welcome! 一如既往地拉要求欢迎! https://github.com/MongoEngine/mongoengine https://github.com/MongoEngine/mongoengine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM