简体   繁体   English

如何使用django-tastypie发送照片

[英]How send photos with django-tastypie

Im new working with django-tastypie. 我与django-tastypie一起工作。 Works fine for send data with json and i don't know how send files with django-tastypie and json and how test this functionality 适用于使用json发送数据,效果很好,我不知道如何使用django-tastypie和json发送文件以及如何测试此功能

django-tastypie is a REST framework, it works with entities serialized in some format (JSON, XML, etc). django-tastypie是一个REST框架,它与以某种格式(JSON,XML等)序列化的实体一起使用。

Technically you can serialize a image an use tastypie, but it will not be easy or elegant. 从技术上讲,您可以使用好吃的照片序列化图像,但是它并不容易或优雅。

Instead, you can use django to upload a image and if needed you can use the file reference (as an URL) in your entities with tastypie without problems. 取而代之的是,您可以使用django上传图像,如果需要,可以在实体中使用文件引用(作为URL)而不会出现问题。

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

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