问题遇到的现象和发生背景
今天搞flask项目的时候遇到一个奇怪的问题,就是flask定位不到HTML文件,代码如下:
用代码块功能插入代码,请勿粘贴截图
from flask import Flask, render_template
app = Flask(__name__, template_folder='/templates', static_url_path='/', static_folder='/resource')
#定义接口地址
app.route('/')
def hello_world():
return render_template('index1.html')
if __name__ == '__main__':
app.run(debug=True)
运行结果及报错内容
打开端口http://127.0.0.1:5000
出现的结果是
Not Found
The requested URL was not found on the server. If you entered the URL manually please check your spelling and try again.
我的解答思路和尝试过的方法
我到网上搜索了相关问题的解决方法,发现这个问题好像挺少有人遇到,但还是找到有人遇到的跟我一样的问题,想请问一下各位大lao有没有懂得,请指导一二。(复制粘贴其他类似问题答案的狗别在这叫)
我想要达到的结果
我想找到这个问题我出在什么地方,我是漏了哪个,请懂得大lao指导一二。(复制粘贴其他类似问题答案的狗别在这叫)