【发布时间】:2016-08-29 01:45:40
【问题描述】:
我正在尝试用 twisted 运行 klein,所以我可以在不同的路径上运行 twisted 脚本(exp:example.com/example1,example.com/example2)。于是我做了一个简单的脚本:
from klein import run, route, Klein
from twisted.internet import reactor
from twisted.web import proxy, server
from twisted.python import log
@route('/example')
def home(request):
site = server.Site(proxy.ReverseProxyResource('www.example.com', 80, b''))
reactor.listenTCP(80, site)
reactor.run()
run("My_IP_Address", 80)
但是每当我运行这个脚本时,我都会收到一个错误:twisted.internet.error.CannotListenError: Couldn't listen on any:80: [Errno 98] Address already in use. 我对 Klein 很陌生,我不确定它是如何工作的,谁能告诉我我做错了什么?谢谢!
【问题讨论】:
标签: python python-3.x proxy twisted klein-mvc