这是我的 Python 代码:
from flask import Flask, render_template
app = Flask(__name__)
@app.route("/profile/<name>")
def profile(name):
return render_template("index.html", name=name)
if __name__ == "__main__":
app.run()
和 HTML 代码:
<!DOCTYPE html>
<html>
<head>
</head>
<body>
Hello {{ name }}
</body>
</html>
当我运行 Python 代码时,它会在浏览器上显示:
Internal Server Error
The server encountered an internal error and was unable to complete your request. Either the server is overloaded or there is an error in the application.
我在 Google 和 Youtube 上寻找解决方案,但仍然无法解决。有人可以帮我弄这个吗?谢谢
编辑:所以我需要做的就是修复这一行:
app = Flask(__name__, template_folder="template")