-1
源代碼在書中,在代碼中沒有錯誤。爲什麼發生錯誤?燒瓶runserver處的錯誤
from flask import Flask, render_template
from flask_script import Manager
app = Flask(__name__)
manager = Manager(app)
@app.route('/')
def index():
return render_template('index.html')
@app.route('/user/<name>')
def user(name):
return render_template('user.html', name=name)
if __name__ == '__main__':
manager.run()
在user.html
<h1>Hello, {{ name }}!</h1>
謝謝!好吧 –