Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/python-3.x/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python Flask render_模板缩进错误_Python_Python 3.x - Fatal编程技术网

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)