我得到一個內部服務器錯誤,我不知道是什麼問題。 index.html
與Python文件位於同一目錄中。爲什麼這個簡單的應用程序返回500錯誤?
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def hello_world():
author = "Rick"
name = "1st flask app"
return render_template('index.html', author=author, name=name)
if __name__ == "__main__":
app.run()
<!DOCTYPE html>
<html>
<head>
<title>{{ author }}'s app</title>
</head>
<body>
<h2>Hello {{ name }}!</h2>
<p>Please show up on the page</p>
</body>
</html>
爲什麼我收到一個500錯誤,而不是我的渲染模板?
請在您的問題中包含來自控制檯輸出或日誌文件的追蹤。 – 2015-04-02 16:33:46