Django-应用程序使用从类似REST的API检索的数据构建报告 [英] Django - app to build reports using data retrieved from a REST-like API

查看:118
本文介绍了Django-应用程序使用从类似REST的API检索的数据构建报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在构建一个Django应用程序,该应用程序使用来自类似REST的扩展API的数据.该API是使用.NET构建的(不好意思!不是我的选择),因为我宁愿动动脑筋,也不愿学习Microsoft工具(我是* nix/OSX专家),并且因为我不想使用前端为了影响API,反之亦然,我选择在另一台服务器上使用Django构建前端.

Django站点充当主DB/API与最终用户之间的中间人. API的任何数据都不会保留在Django站点中,它只是以一种易于理解的格式重新格式化/显示了这些数据.现在,我已经构建了我的API客户端和所有视图,我希望创建一个报告生成器.

是否已经有任何应用程序可以创建临时模型来表示API调用中的对象?我希望能够在从API接收到的JSON/XML数据之间创建关系,但是不需要在Django站点中复制数据库结构,那将是多余的.

最终目标是使用户能够根据数据API的请求创建/保存自定义过滤的报告.任何建议将不胜感激. (请不要回答只是在Django中复制模型,然后插入从API检索的数据".这完全将使DB/API在与前端不同的服务器上运行的意义完全废除. /p>

注意-我已经看过两个人的《黑暗之夜》,但是由于上面没有文档,也没有相关的'docu'库的文档,所以我真的不知道这对我有什么好处.如果您有如何使用它们来解决此问题的示例,请告诉:)

解决方案

实际上,我最终找到了解决此问题的方法,很久以后,大声笑.

谢谢djangopackages.com !!!

显然,我要寻找的是ROA(面向资源的体系结构)一词.这是来自Ruby on Rails世界的范例.有一个django应用程序可以处理 django-roa

所以我将尝试一下,感谢@Yuval Adam的尝试

I have been building a Django Application which consumes data from an expansive REST-like API. The API was built using .NET (yuck! not my choice), and since I would rather gouge out my eyeballs than learn Microsoft tools (I'm a *nix/OSX guy), and since I do not want the front-end to affect the API or vice-versa, I elected to build the front-end using Django on another server.

The Django site acts as a middleman between the main DB/API and the End-User. None of the data from the API is persisted in the Django site, it simply reformats/displays said data in a nice human-readable format. Now that I have built my API client and all of my views, I am looking to create a report builder.

Are there any apps out there already that can create Transitory Models to represent objects from an API call? I would like to be able to create relations between JSON/XML data received from the API, but not need to duplicate the DB structure in my Django site, that would be redundant.

The end goal would be to be able to have a user create/save custom filtered reports based on requests from the data API. Any suggestions would be greatly appreciated. (please don't respond with 'just duplicate the models in Django, and insert the data retrieved from the API'. That completely would completely nullify the point of having the DB/API running on a different server than the front-end.

Note - I have looked at neithere's Dark, but with the lack of documentation on it, and the lack of documentation on the dependent 'docu' library, I really have no idea if it is any good to me. If you have any examples of how to use them to solve this problem, please do tell :)

解决方案

I actually ended up finding a solution to this problem, very much later lol.

Thank you djangopackages.com!!!

Apparently there is a term for what I was looking for, ROA (Resource Oriented Architecture). This is a paradigm from the world of Ruby on Rails. There is a django app which handles this called django-roa

so i will experiment with that, thanks for the attempt @Yuval Adam

这篇关于Django-应用程序使用从类似REST的API检索的数据构建报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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