简体   繁体   English

实时网站的python框架

[英]python frameworks for a real time website

I'm trying to learn web programming in python, and have the following project in mind: mine the yahoo finance api for instrument data, and display it in real time, as well as plot charts based on instrument data. 我正在尝试使用python学习Web编程,并且考虑到以下项目:挖掘Yahoo Finance API的工具数据,并实时显示它,以及基于工具数据的图表。

I already did something similar using wxpython, and I'm interested in how I would accomplish this in a web application. 我已经使用wxpython做过类似的事情,并且我对如何在Web应用程序中完成此过程很感兴趣。

My first thought was to use django and matplotlib on the server, and have the client request updated chart images through jquery at a certain time interval, but after a bit of research I came upon libraries like twisted and tornado...and now I'm confused. 我的第一个想法是在服务器上使用django和matplotlib,并让客户端在一定的时间间隔内通过jquery请求更新图表图像,但是经过一番研究,我发现了Twisted和Tornado之类的库……现在我我很困惑。 Would they work better for this web app than django ? 他们会比django在此Web应用程序上更好地工作吗?

After the above rambling, my question is: what library should I use for writing the web app i have in mind ? 经过上述讨论之后,我的问题是:我应该使用哪个库来编写Web应用程序? I'm also thinking that I should abandon matplotlib, and generate the chart on client side, but I'm not sure what javascript library would allow me to do that, if any. 我还认为我应该放弃matplotlib,并在客户端生成图表,但是我不确定哪个javascript库可以允许我执行此操作(如果有)。

Few tips: 一些提示:

1/ Do not plot your data at backend . 1 /不要在后端绘制数据。 Instead use the browsers to generate charts.I would recommend using jqplot , or highcharts . 而是使用浏览器生成图表。我建议使用jqplothighcharts

2/ Yes, you can use tornado or twisted instead of django, as they are asynchronous servers, and would provide faster handling of requests. 2 /是的,您可以使用龙卷风或twisted而不是django,因为它们是异步服务器,并且可以更快地处理请求。

3/ You should create a REST interface of your application, with server side only sending JSON data, and do all the UI templating and charting on client side. 3 /您应该创建应用程序的REST接口,服务器端仅发送JSON数据,并在客户端进行所有UI模板化和图表化。

4/ Backbone.js (recommended, but you can use some other MVC framework), would also prove to be helpful if your app grows too complex. 4 / Backbone.js (推荐,但您可以使用其他MVC框架),如果您的应用程序变得过于复杂,也会证明是有帮助的。

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

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