PyCharm 的代码编辑器在将 “index.html”
传递给 render_template
时显示弹出消息 Template file 'index.html' not found
。模板 templates/index.html
存在。访问 http://localhost:5000/
呈现模板。我如何告诉 PyCharm 该模板存在?
@app.route('/')
def index():
return render_template('index.html')
最佳答案
右键单击您的模板目录,转到“将目录标记为”,然后选择“模板目录”。
关于python - PyCharm 找不到存在的 Flask 模板,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45017338/