我是烧瓶开发的新手,这是我在烧瓶中的第一个程序,但它向我显示了这个错误:
在服务器上找不到请求的 URL。如果您输入了网址
请手动检查拼写并重试。
这是我的代码
from flask import Flask
app = Flask(__name__)
@app.route('/index')
def index():
return 'Hello World'
if __name__ == '__main__':
app.run(debug=True)
我想你应该去http://localhost:5000/index http://localhost:5000/index or http://127.0.0.1:5000/index http://127.0.0.1:5000/index但如果你想制作该页面,你的代码应该是这样的
from flask import Flask
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World'
if __name__ == '__main__':
app.run(debug=True)
change @app.route('/index')
to @app.route('/')
你也应该检查这个http://flask.pocoo.org/docs/0.12/quickstart/#routing http://flask.pocoo.org/docs/0.12/quickstart/#routing
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)