django芹菜

编程入门 行业动态 更新时间:2024-10-21 11:40:37
本文介绍了django芹菜 - 如何发送request.FILES ['照片']到任务的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在尝试通过以下方式发送request.FILES ['photo'],一个上传的文件到tCelery:

i'm trying to send request.FILES['photo'], an uploaded file from my site, to tCelery via:

tasks.upload_photos.delay(img=request.FILES['photo'])

I得到一个pickle错误,因为它不能序列化它。发送文件到任务的方式是什么?

I get a pickle error because it cannot serialize it. What is the way to send a file to task?

错误:无法打开StringO对象谢谢。

error: "can't pickle StringO objects" thanks.

推荐答案

将文件内容读入字符串,然后用dict中的内容类型打包,然后发送。

Read the file contents into a string, then pack it with the content type in a dict and send that.

更多推荐

django芹菜

本文发布于:2023-11-24 23:02:39,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1627245.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:芹菜   django

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!