Python Web框架+ [a]同步任务;长轮询:不是Django [英] Python web framework + [a]sync tasks; long polling: not Django

查看:190
本文介绍了Python Web框架+ [a]同步任务;长轮询:不是Django的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要创建一个具有Web前端的项目,以管理同步任务执行(ala结构),异步任务(AMQP)和长轮询/ajax,以表格形式查看结果和队列/频繁变化的大型数据集(认为tail -f syslog).我有一个用于许多实现特定内容的现有Python代码库.

I need to create a project that has a web frontend to manage synchronous task execution (ala fabric), async tasks (AMQP), and long-polling/ajax for tabular viewing of results and queues/large, frequently changing datasets (think tail -f syslog). I have an existing Python codebase for a lot of the implementation-specific stuff.

看了一堆现有框架后,最明显的答案似乎是Django + Celery.但是,我不想学习Django",也不需要95%的功能.我只需要简单的auth,也许sqlalchemy,简单的ajax,amqp,xmlrpc会有所帮助.

After looking at a bunch of existing frameworks, the obvious answer appears to be Django+Celery. However, I do not want to "learn Django", nor do I need 95% of it's functionality. I just need simple auth, maybe sqlalchemy, easy ajax, amqp, xmlrpc would be helpful.

我会考虑使用Mongrel2,但相对于0MQ,我更倾向于RabbitMQ(出于某些特定于实现的原因).

I would consider using Mongrel2, but I have a strong preference for RabbitMQ over 0MQ (for a few implementation-specific reasons).

最初,我花了大量时间学习Twisted,最终从中获得了数百个有用的LOC,但是我发现我扭曲了太多的平台代码,无法适应其回调模型.它实际上非常适合"(除了它自己的amqp实现之外),但是它是如此令人沮丧,而且我经历了如此多的代码迭代(每个扭曲的ahah时刻"一个),结果是100%了.

I originally spent a great deal of time learning Twisted, and ended up getting a few hundred useful LOC out of it, but I found that I was twisting (lol) too much of my platform code to fit it's callback model. It actually 'fit the bill' very well (except with it's own amqp implementation), but it was so frustrating, and I went through so many iterations of code (one for each 'twisted ahah moment'), that it's 100% out.

有人可以帮我渡过泥潭吗?龙卷风? 塔?重击?金字塔?烧瓶?瓶子? CherryPy? Web2py?贴/Webob?还有什么@ http://wiki.python.org/moin/WebFrameworks ?

Can somebody please help me wade through the mire? Tornado? Pylons? repoze? Pyramid? Flask? Bottle? CherryPy? Web2py? Paster/Webob? Anything else@ http://wiki.python.org/moin/WebFrameworks?

很明显,与RabbitMQ(或其他amqp提供程序)的集成至关重要,这实际上是问题的症结所在.

To be clear, integration with RabbitMQ (or another amqp provider) is of the utmost importance, and is really the crux of problem.

推荐答案

我对python Web框架没有完整的了解,但只想分享我对其中两个的观点:

I don't have a full vision of python web frameworks but just want to share my point of view on 2 of them :

  • 瓶子很轻,可以正常工作.如果您想要简单易学且易于使用的东西,则可能是正确的选择.我将它用于在本地运行的非常简单的前端应用程序,我非常喜欢它.

  • Bottle is light and works fine. If you want something easy to learn and easy to use that may be the right choice. I used it for quite simple front-end apps running locally and i liked it very much.

在我看来,Tornado是一个非常好的实时Web应用程序的非阻塞服务器.与 tornadio 结合使用,它使ajax-long-polling非常容易.但是,它可能比Bottle更难学习.我建议看看tornadio的示例文件夹中的聊天应用程序.

Tornado seems to me as a very good non-blocking server for real-time web app. Combined with tornadio it makes ajax-long-polling quite easy. However, it may be a little harder to learn than Bottle. I would recommend to have a look to the chat app in the example folder of tornadio.

我希望对您有帮助

这篇关于Python Web框架+ [a]同步任务;长轮询:不是Django的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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