本文介绍了用扭曲和网络编程的方式去哪里?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我在几个月前编写了这个扭曲的应用程序,我现在想用一个基于Web的用户界面进行配置。

So, I programmed this twisted application a few months ago, which I now would like to extend with a web-based user interface for configuration.

Twisted网站推荐Nevow,但我不确定这是否是一个不错的选择。他们的网站有一段时间看起来,他们的启动板页面在半年内没有看到任何更新。这个项目是否死亡?
此外,我已经看到Nevow的移动部分在twisted-web邮件列表中的twisted.web的讨论。那么,仍然推荐新的开发项目?

The Twisted website recommends Nevow, but I am not really sure if this is a good choice. Their website is down for a while it seems and their launchpad page hadn't seen any update in half a year. Is this project dead?Additionally I have seen discussion of moving parts of Nevow into twisted.web on the twisted-web mailinglist. So, is it still recommended for new developments?

另一个想法是使用Django。在配置界面中,我还需要用户身份验证和权限,我对此非常熟悉。 (我从来没有与Nevow或twisted.web合作)
但是看起来很难接口这两个世界,所有我可以找到的是在Twisted中运行Django与WSGI的例子。

Another idea was using Django. I would need user authentication and permissions anyway in the config-interface, and I am quite familiar with it. (I have never worked with Nevow or twisted.web)But it seems quite difficult to interface both worlds, all I could find were examples of running Django with WSGI in Twisted.

有没有其他的可能性有一个光滑的用户界面在扭曲之上?

Are there any other possibilities to have a slick looking user interface on top of twisted?

推荐答案

首先,让我解释了Nevow死了的感觉。包含Nevow(和其余Divmod项目)的代码的启动板项目是。硬件故障严重影响了项目的公开存在,但仍然存在,其他事情(如维基和门票)正在被恢复。现在没有很多的主动维护工作,但这主要是因为它对大部分用户而言都是足够好的;有很多人依靠Nevow,如果停止工作,会很失望。那些人有持续保持的必要技能和经验。所以,虽然现在还没有被积极的推广,但我觉得不太可能会消失。

First, let me address the perception that Nevow is dead. The launchpad project containing the code for Nevow (and the rest of the Divmod projects) is divmod.org on launchpad. A hardware failure has badly impacted the project's public presence, but it's still there, and other things (like the wiki and the tickets) are in the process of being recovered. There isn't a lot of active maintenance work going on right now, but that's mostly because it's good enough for most of its users; there are lots of people who depend on Nevow and would be very upset if it stopped working. Those people have the skills and experience necessary to continue maintaining it. So, while it's not being actively promoted right now, I think it's unlikely that it's going to go away.

我对Nevow的长期希望如下。 (我会说计划,但是由于我最近没有积极参与维护工作,这真的取决于那些人。)首先,我想提取其模板设施并将其转化为扭曲。网页。 Nevow的干净,不被淘汰的API大部分覆盖在中以及各种。扭曲本身想要在几个地方生成HTML,这些设施可能是有用的。那么我们应该抛出Nevow的appserver和资源模型部分。这些大多数只是一个随机的,用于twisted.web的错误修复或修改的集合,其中大部分在twisted.web2中以某种形式出现,因此无论如何都被回滚到twisted.web,或者已被应用于那里。最后有雅典娜的问题。虽然双向通信是Twisted的优势之一,但雅典娜本身就是一个巨大的,广泛的JavaScript代码库,应该可以保留在自己的项目中。

My long-term hope for Nevow would be as follows. (I'd say "plan", but since I haven't been actively involved with its maintenance lately, this is really up to those who are.) First, I'd like to extract its templating facilities and move them into twisted.web. The clean, non-deprecated API for Nevow is mostly covered by nevow.page.Element and the various loaders. Twisted itself wants to generate HTML in a few places and these facilities could be useful. Then we should throw out the "appserver" and resource-model parts of Nevow. Those are mostly just a random collection of bugfixes or alterations for twisted.web, most of which were present in some form in twisted.web2 and will therefore either be rolled back into twisted.web anyway, or have already been applied there. Finally there's the question of Athena. While two-way communication is one of Twisted's strengths, Athena is itself a gigantic, sprawling JavaScript codebase and should probably remain its own project.

第三,关于主要问题给出这些信息,你现在应该怎么做?

Third, on to the main question, given this information, what should you do now?

一般来说,我会说,使用nevow。该项目有一些疣,它需要更多的文档,它的API需要修剪,以消除一些旧的和破碎的东西,但它仍然非常有用和非常活跃。为了弥补稍微稀疏的文档,您可以在Freenode上加入 #divmod #twisted.web 得到帮助。如果您可以通过提供补丁来帮助您,那么您会发现您将获得很多热情的帮助。当您忽略不推荐的部件时,Nevow拥有一个非常小巧,合理的扭曲友好的API。上面我概述的Nevow进化计划的后果其实很少。如果甚至发生这种情况,那么对于 来说,这意味着1-5年内,当您升级到Twisted的新版本时,您会收到一些不赞成的警告, code> import 你的代码中的行来自 from nevow.page import ...;从nevow.loaders导入... 到一些假想的新事物,如$ code from twisted.web.page.element import ...;来自twisted.web.page.templates import ... 或somesuch。过去的API大部分应该保持不变,高层次的概念绝对不会有太大的变化。

Generally speaking, I'd say, "use nevow". The project has some warts, it needs more documentation and its API needs to be trimmed to eliminate some old and broken stuff, but it's still quite useful and very much alive. To make up for the slightly sparse documentation, you can join the #divmod or #twisted.web channels on Freenode to get help with it. If you help out by contributing patches where you can, you will find that you'll get a lot of enthusiastic help there. When you ignore the deprecated parts Nevow has a pretty small, sane, twisted friendly API. The consequence of the plan for Nevow's evolution that I outlined above are actually pretty minimal. If it even happens at all, what it means for you is, in 1-5 years, when you upgrade to a new version of Twisted, you'll get a couple of deprecation warnings, change some import lines in your code from from nevow.page import ...; from nevow.loaders import ... to some hypothetical new thing like from twisted.web.page.element import ...; from twisted.web.page.templates import ..., or somesuch. Most of the API past that point should remain the same, and definitely the high-level concepts shouldn't change much.

使用Nevow获得的主要优点是它是异步友好的,可以在您的主线程中渲染页面,而不会阻止任何东西。此外,您可以使用雅典娜免费使用COMET。

The main advantage that you get from using Nevow is that it's async-friendly and can render pages in your main thread without blocking things. Plus, you can then get really easy COMET for free with Athena.

您还可以使用Django。这不是非常友好的,但它显然有更广泛的支持基础。但是,不如同步友好并不意味着难以使用。您可以使用twisted.web通过,来调用任何返回Deferred的Twisted API,应该足够强大,做任何你想要的任何事情。如果您有一个更具体的问题,关于如何实例化Twisted Web资源以组合Twisted Web和Django,您应该可以自己的Stack Overflow问题。

You can also use Django. This is not quite as async-friendly but it obviously does have a broader base of support. However, "not as async friendly" doesn't mean "hard to use". You can run it in twisted.web via WSGIResource, and simply use blockingCallFromThread in your Django application to invoke any Twisted API that returns a Deferred, which should be powerful enough to do just about anything you want. If you have a more specific question about how to instantiate Twisted web resources to combine Twisted Web and Django, you should probably ask it in its own Stack Overflow question.

这篇关于用扭曲和网络编程的方式去哪里?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 14:41