1
我用燒瓶並試圖顯示我的HTML文件,但是,我總是得到一個404。我的HTML文件已經在我的模板文件夾。這是下面的項目結構:爲什麼render_template沒有找到404?
projectfolder/
app.py
templates/
frontend.html
這是代碼:
import sys
sys.path.append('C:\Users\Software\Anaconda2\Lib\site-packages')
from flask import Flask, render_template
app = Flask(__name__)
if __name__ == "__main__":
app.run(debug=True)
@app.route('/')
def home():
return render_template('frontend.html')
哇,它的工作!非常感謝! – user1234567890