Python Flask render_模板缩进错误
我写了一些代码,比如Python Flask render_模板缩进错误,python,python-3.x,Python,Python 3.x,我写了一些代码,比如 from flask import Flask, render_template app = Flask(__name__) @app.route('/') def home(): t = "!!!!!!" return render_template('hello.html', title=t) if __name__ == '__main__': app.run(debug=True) 我还有模板文件夹中的hello.html模板 &l
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def home():
t = "!!!!!!"
return render_template('hello.html', title=t)
if __name__ == '__main__':
app.run(debug=True)
我还有模板文件夹中的hello.html模板
<!DOCTYPE html>
<html>
<head>
<title>TEST</title>
</head>
<body>
<p> {{ title }}</p>
</body>
</html>
但是当我在没有title参数的情况下运行(
return render\u template('hello.html')
)时,它工作得很好。如何解决它?代码在我的设置中运行良好:Flask 1.0.2和python 3.6.5。请查看您的设置,也许可以将virtualenv与前面提到的版本一起使用。我的设置是Python 3.7.0和Flask 1.0.2
File "webui-controller.py", line 9
return render_template('hello.html', title=t)