gpt4 book ai didi

python - Chrome 错误代码 : ERR_UNSAFE_PORT - Bottle hello world app not showing in browser

转载 作者:行者123 更新时间:2023-12-01 05:23:31 31 4
gpt4 key购买 nike

编辑:

我查看了 chrome 错误代码,它显示:错误代码:ERR_UNSAFE_PORT。我将端口更改为 6001,它工作正常 - 为什么会这样,6000 通常是由于某种原因不能用于本地开发的端口?

我已经构建了 hello world 应用程序(我将其称为 app.py),如下所示:

from bottle import route, run

@route('/hello')
def hello():
return "<h1>Hello World!</h1>"

run(host='localhost', port=6000, debug=True)

我处于 virtualenv 设置中,其中 app.py 与虚拟环境中的 bin/、include/和 lib/文件夹位于同一目录级别。文件 Bottle.py 位于 bin/内 当我运行 python app.py 时,我得到以下输出:

Bottle v0.12.3 server starting up (using WSGIRefServer())...
Listening on http://localhost:6000/
Hit Ctrl-C to quit.

但是当我访问 http://localhost:6000/hello 时,我在 Chrome 中收到“此网站不可用”。我的文件结构是否错误?谢谢!

最佳答案

这不是您的应用,而是 Chrome。

来自https://superuser.com/a/188012/220530 :

Right Click on Chrome shortcut >> Properties >>

Then Append --explicitly-allowed-ports=xxx to shortcut target

Example:

C:\Documents and Settings\User\Local Settings\ApplicationData\Google\Chrome\Application\chrome.exe--explicitly-allowed-ports=6666

关于python - Chrome 错误代码 : ERR_UNSAFE_PORT - Bottle hello world app not showing in browser,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21845935/

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