【问题标题】:Bottle framework python - site cannot be reached瓶子框架python - 无法访问站点
【发布时间】:2017-10-14 02:07:07
【问题描述】:

我也是 Python 编程和 Bottle 框架的新手。我写了一个基本的 hello, world 程序,如下所示:

from bottle import run, route

@route('/')
def index():
    return '<h1>Hello, World</h1>'

if __name__ == '__main__':
    run(host='localhost', port=8080, debug=True)

这段代码的输出是

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

但是当我在浏览器中输入http://localhost:8080/ 时,我收到错误-“无法访问该站点”

我是否缺少一些配置。我正在学习使用this youtube 视频

【问题讨论】:

  • 你试过this 吗?可能重复
  • 同样的命运。没有运气。
  • 浏览器和应用是否在同一个系统上?
  • 是的。两者都在同一个系统上

标签: python localhost bottle


【解决方案1】:

确保没有其他程序正在访问服务器。你也在使用 IPyhton 吗?只是一个健全的检查没有什么花哨的。

【讨论】:

  • 完美。 IPython 控制台在另一个窗口中打开。根本没关。谢谢!
猜你喜欢
  • 1970-01-01
  • 2018-03-31
  • 1970-01-01
  • 2021-04-28
  • 2020-10-24
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2015-01-04
相关资源
最近更新 更多