【发布时间】:2023-03-29 11:06:02
【问题描述】:
我有两个文件 - app.py 包含 REST API 的代码,另一个页面 index.html 使用 AngularJS 显示 API 的一些内容。目前,我必须从浏览器打开 index.html 文件才能使其正常工作(在部署服务器 http://localhost:5000 之后)。
我试过了
@app.route('/')
def index():
return render_template('/index.html',
title='Home')
它给出了错误“TemplateNotFound:/index.html”。目前,app.py 和 index.html 在同一个目录下。如何更改格式以让 Flask 知道它必须在此 URL 上呈现页面 index.html。
【问题讨论】:
-
“它不工作”不是错误描述。
标签: python angularjs rest flask flask-restful