使用Django为Dojo的JsonRestStore实现安静的服务器 - 哪些工具可用? [英] Implementing restful servers with Django for Dojo's JsonRestStore - Which tools for the job?

查看:136
本文介绍了使用Django为Dojo的JsonRestStore实现安静的服务器 - 哪些工具可用?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在写一些休息的服务器资源,在客户端与dojo的JsonRestStore(JRS)进行交谈:



http://dojotoolkit.org/reference-guide/dojox/data/JsonRestStore.html



我注意到有几个项目可以用来帮助创建安静的资源(即在Django模型上公开简单的CRUD操作):



http://code.google.com/p/django -rest-interface /





http://django-rest-framework.org/



我相信我可以从头开始为Dojo的JRS写下休息的serveride界面,但是我不想重新发明任何轮子,所以我的问题是:



以上项目?



是否会帮助我说明目标?



有没有其他项目,我可能想看看为了这个任务?



请注意,JRS提供请求的方式有一些具体的细节,并期望我将需要实现的响应。这里有几个(不完整)的例子,以便你知道我在说什么。创建:响应状态为201,并为新创建的资源使用位置:/ path / id 标题。集合:解析范围:items = x-y 标题,并使用它来分页响应。使用 Content-Range:items x-z 头响应。 JSON中的序列化模型作为集合的字典列表,或单个项目的简单字典。

解决方案

我会看看活塞,tastypie和django-rest框架,老实说,他们大都很相似,我只想浏览文档,看看你认为合适的帐单。



我不认为这些将会本地支持您的范围分页,你提到它可能是你需要处理的事情。



活塞是爸爸,没有积极维护ATM,这不一定和问题,因为它几乎完成你想要的反正。 Tastypie的优势在于它拥有一个伟大的社区,并且有很好的记录。 django-rest-framework具有管理风格的API浏览器,文档中的大量示例和不断增长的社区。 django-rest-interface是非常体面的AFAIK,但是我不知道ATM背后的任何社区努力。


I'm writing some restful serverside resources which talk with dojo's JsonRestStore (JRS) on the client-side:

http://dojotoolkit.org/reference-guide/dojox/data/JsonRestStore.html

I notice that there are a couple of projects that I may be able to leverage to help create restful resources (i.e. to expose simple CRUD operations on Django models):

http://code.google.com/p/django-rest-interface/

and

http://django-rest-framework.org/

I'm confident that I could write the restful serverside interface for Dojo's JRS from scratch, but I don't want to reinvent any wheels, so, my questions are:

What's the difference between the above projects?

Will either help me with the stated goal?

Are there any others projects I might want to look at for this task?

Note that there are some specific details of the way that JRS makes requests and expects responses that I will need to implement. Here's a couple of (incomplete) examples so that you know what I'm talking about. Creation: respond with status of 201 and a Location: /path/id header for the newly created resource. Collections: parse the Range: items=x-y header and use this to paginate a response. Respond with the Content-Range: items x-z header. Serialise models in JSON as a list of dictionaries for collections, or a simple dictionary for single items.

解决方案

I'd take a look at piston, tastypie and django-rest-framework, honestly they're mostly pretty similar, I'd just take a run through the docs and see which you think fits the bill.

I don't think any of those will natively support the Range pagination you mention it's probably something you'd need to deal with yourself.

Piston is the daddy, tho not being actively maintained ATM, that's not necessarily and issue as it pretty much does what you want anyway. Tastypie's advantages are that it has a great community behind it, and is well documented. django-rest-framework has the admin style API browser, plenty of examples in the docs, and a growing community. django-rest-interface is perfectly decent AFAIK, but I don't know of any community effort behind it ATM.

这篇关于使用Django为Dojo的JsonRestStore实现安静的服务器 - 哪些工具可用?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆