gpt4 book ai didi

twisted - 在 Azure 网站上运行 Twisted

转载 作者:行者123 更新时间:2023-12-02 03:28:56 27 4
gpt4 key购买 nike

Azure 网站能否托管 Twisted 应用程序?例如像这样的东西:

from twisted.internet import reactor
from twisted.web import server

site = server.Site(myresource)
reactor.listenTCP(80, site)
reactor.run()

来自 http://azure.microsoft.com/en-us/documentation/articles/web-sites-python-configure/听起来好像只支持 WSGI 应用程序,但只是想从 Azure 网站专家那里确认没有办法直接运行上述内容。

--

在#twisted.web IRC channel 中与 Glyph(Twisted 作者)的讨论摘录涵盖了这个问题的 Twisted 部分:

16:53:28 glyph: twisted has a WSGI _container_
16:53:34 glyph: twisted _is not_ a WSGI application
16:53:36 glyph: in any part
16:53:43 glyph: so you can't make twisted into a WSGI app
16:53:55 glyph: you can maybe invoke some Twisted code _from_ a WSGI app
16:54:05 glyph: but what that example is doing is speaking HTTP, and WSGI applications have to speak WSGI, they are not allowed to speak HTTP directly.
16:56:47 tos9: crochet?
16:56:56 glyph: tos9: crochet can't eat the inbound HTTP socket
16:56:58 glyph: tos9: so it doesn't help
16:57:11 glyph: you could write a thing that did the _outgoing_ traffic with Twisted, but since you can't handle the inbound request, you're bummed
16:57:37 glyph: basically Twisted's job is doing network I/O and if you're inside a WSGI stack, someone else is already doing the job of doing the network I/O

如果实际上没有办法直接运行这样的东西,那么选择 Python 以外的语言似乎可以让你在 Azure 网站上获得更大的灵 active 。例如,来自 http://azure.microsoft.com/en-us/documentation/articles/web-sites-nodejs-develop-deploy-mac/看起来您可以在 Azure 网站上托管一个直接使用 HTTP 的 Node 应用程序。非常感谢收到确认或更正。

最佳答案

请查看https://social.msdn.microsoft.com/Forums/en-US/ed1c80c4-4621-4d02-8902-6ecc1166ac8c/running-twisted-on-azure-websites?forum=windowsazurewebsitesprevie&prof=required求解答。

如您在 Running Twisted on Azure Websites 中所述.

你说的对。对于 node.js,您可以在 Azure 网站上托管一个直接使用 HTTP 的 Node 应用程序。请引用http://blogs.msdn.com/b/hanuk/archive/2012/05/05/top-benefits-of-running-node-js-on-windows-azure.aspx

对于 Python,没有直接的方法通过 http 运行扭曲代码。

关于twisted - 在 Azure 网站上运行 Twisted,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28620060/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com