【发布时间】:2015-11-09 09:26:42
【问题描述】:
尽管阅读了文档和教程,但我无法弄清楚的看似微不足道的问题。继续咳嗽:
builtins.ValueError
ValueError: View function did not return a response
每当我尝试渲染我的模板时。使用 PyCharm 作为编辑器,不会警告任何问题。
website.py:
from flask import Flask, url_for, request, render_template
app = Flask(__name__, template_folder='templates')
@app.route('/')
def hello_world():
render_template('hello_world.html')
if __name__ == '__main__':
app.debug = True
app.run()
hello_world.html:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Hello, Flask</title>
</head>
<body>
<h1>Hello, World and Flask!</h1>
</body>
</html>
【问题讨论】: