扭曲应用程序的 Web 界面
我有一个用 Twisted 编写的应用程序,我想添加一个 Web 界面来控制和监视它。我需要大量的动态页面来显示当前状态和配置,因此我希望有一个框架至少提供一种具有继承和一些基本路由的模板语言。
因为我无论如何都在使用 Twisted,所以我想使用 twisted.web
- 但它的模板语言太基础了,而且似乎唯一的框架 Nevow 已经死了(它是 在启动板上,但主页和 wiki 已关闭,我找不到任何文档)。
那么我有什么选择呢?
- 还有其他基于
twisted.web
的框架吗? - 还有其他框架可以与twisted的reactor一起使用吗?
- 我应该获取一个 Web 框架(我正在考虑 web.py 或 Flask)并在线程中运行它吗?
感谢您的回答。
I have a application written in Twisted and I want to add a web interface to control and monitor it. I'll need plenty of dynamic pages that show the current status and configuration, so I hoped for a framework that offers at least a templating language with inheritance and some basic routing.
Since I am using Twisted anyways I wanted to use twisted.web
- but it's templating language is too basic and it seems that the only framework, Nevow is quite dead (it's on launchpad but the homepage and wiki are down and I can't find any documentation).
So what are my options?
- Is there any other
twisted.web
based framework? - Are there other frameworks that work with twisted's reactor?
- Should I just get a web framework (I'm thinking web.py or flask) and run it in a thread?
Thanks for your answers.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
由于 Nevow 仍然处于关闭状态,而且我不想自己编写路由和对模板库的支持,所以我最终使用了 Flask。事实证明这非常简单:
到目前为止它工作得完美无缺。
Since Nevow is still down and I didn't want to write routing and support for a templating lib myself, I ended up using Flask. It turned out to be quite easy:
It works flawlessly so far.
您可以将其直接绑定到反应器中,如下例所示:
如果您需要将子级添加到 WSGI 根,请访问 此链接了解更多详细信息。
下面的示例展示了如何将 WSGI 资源与静态子资源结合起来。
You can bind it directly into the reactor like the example below:
If you need to add children to a WSGI root visit this link for more details.
Here is an example showing how to combine WSGI Resource with a static child.
New 是显而易见的选择。不幸的是,divmod Web 服务器硬件和备份服务器硬件同时出现故障。他们正在尝试恢复数据并将其发布在启动板上,但这可能需要一段时间。
您还可以使用twisted.web 基本上任何现有的模板模块;我想到了 Jinja2。
Nevow is the obvious choice. Unfortunately the divmod web server hardware and the backup server hardware failed at the same time. They are attempting to recover the data and publish it on launchpad, but it may take a while.
You could also use basically any existing template module with twisted.web; Jinja2 comes to mind.