问题描述
我一直在挣扎与选择的方法来创建具有Django的一个RESTful API。我已经试过的办法似乎都不是银子弹头。从 WAPI可能是最接近我想完成什么,但我不知道这是否是可以接受的真正的RESTful API有那些资源标识符在查询字符串,而不是在一个干净的URL格式参数。修改WAPIs RestBinding.PATTERN清理了的网址有什么建议?我探讨的另一个选择是Django的休息接口。然而这个框架似乎违背了我所需要的最重要的部分之一,那就是,以包括(参见http://jacobian.org/writing/rest-worst-practices/使用不当的链接)。最后的选择是使用Django,刘欣,基本上做到了很长的路。
I have been struggling with choosing a methodology for creating a RESTful API with Django. None of the approaches I've tried seem to be the "silver" bullet. WAPI from http://fi.am is probably the closest to what I would like to accomplish, however I am not sure if it is acceptable in a true RESTful API to have parameters that are resource identifiers be in the querystring instead of in a "clean" URL format. Any suggestions for modifying WAPIs RestBinding.PATTERN to "clean" up the URLs? Another option I've explored is Django-Rest-Interface. However this framework seems to violate one of the most important pieces I need, and that is to include the full resource URL for references to other resources (see http://jacobian.org/writing/rest-worst-practices/ Improper Use of Links). The final option is to use django-multiresponse and basically do it the long way.
请给我你最好的建议,特别是那些处理这个决定的人。
Please offer me your best advice, especially people that have dealt with this decision.
推荐答案
我相信现在最近发布的Django的活塞是创建在Django适当REST接口的最佳解决方案。
I believe the recently released django-piston is now the best solution for creating a proper REST interface in Django. django-piston
的 注意:Django的活塞似乎不再保持(见下面的评论)的
Note: django-piston seems to no longer be maintained (see comments below)
这篇关于Django和RESTful API中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!