Upload files to DEFAULT_FILE_STORAGE instead of GridFs with mongoengine

天涯浪子 提交于 2019-12-04 02:21:58

问题


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?

Is there a custom filefield out there, that behaves like the regular django FileField?


回答1:


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



来源:https://stackoverflow.com/questions/11986196/upload-files-to-default-file-storage-instead-of-gridfs-with-mongoengine

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!