Twisted html文件列表给出“请求未返回字节”

2024-10-02 00:39:36 发布

您现在位置:Python中文网/ 问答频道 /正文

我有一个扭曲的网络应用程序。我想为GET请求调用一个Html文件(我的Html文件在运行Twisted应用程序的同一个文件夹中)

    class Root(resource.Resource):
        isLeaf = False


        def render_GET(self, request):
            return self.returnResponse(request)

        def returnResponse(self, request):
            request.setHeader(b"content-type", b"text/html")
            return File("Info.html")

site = Root()
site.putChild('cache', NetworkCacheManager())
endpoints.serverFromString(reactor, "tcp:port=8080:interface=0.0.0.0").listen(server.Site(site))
reactor.run()

当我运行服务器时,我收到500个错误

^{pr2}$

怎么了?在


Tags: 文件self程序getreturnrequestdefhtml

热门问题