【发布时间】:2012-04-13 13:56:59
【问题描述】:
到目前为止,我还没有让 Cherrypy 与 Chrome 一起工作,但我愿意。 所以这里是代码:
import cherrypy
class HelloWorld(object):
def index(self):
return "Hello World!"
index.exposed = True
cherrypy.quickstart(HelloWorld())
当我在带有 Python 2.6 的 Mac OS X 10.7.3 上运行它并输入:
http://127.0.0.1:8080
适用于:Firefox、Opera、Safari
Chrome:不起作用 =>“糟糕,无法连接……”
谁能重现这个?我的错在哪里?
编辑:这是一开始的输出
[15/Apr/2012:14:09:17] ENGINE Listening for SIGHUP.
[15/Apr/2012:14:09:17] ENGINE Listening for SIGTERM.
[15/Apr/2012:14:09:17] ENGINE Listening for SIGUSR1.
[15/Apr/2012:14:09:17] ENGINE Bus STARTING
CherryPy Checker:
The Application mounted at '' has an empty config.
[15/Apr/2012:14:09:17] ENGINE Started monitor thread 'Autoreloader'.
[15/Apr/2012:14:09:17] ENGINE Started monitor thread '_TimeoutMonitor'.
[15/Apr/2012:14:09:17] ENGINE Serving on 127.0.0.1:8080
[15/Apr/2012:14:09:17] ENGINE Bus STARTED
【问题讨论】:
-
您的代码中没有任何内容表明只有在 Chrome 上才会出现的错误。你的终端中是否有任何错误声明?
-
终端没有错误,当Chrome尝试加载时,终端什么也没有出现
-
可能是CP绑定了不同的地址。也许您可以从 CherryPy 的日志中粘贴“在 ____ 上服务 HTTP”行。
-
这是疯狂的尝试,但与您在 chrome 中的连接设置有关吗?例如代理?无论如何,cherrypy 不必对您使用的浏览器做任何事情..
-
在开始后添加了输出,也许有帮助?!我不使用代理,所以在 chrome 中没有特殊设置。
标签: python google-chrome localhost cherrypy