-2
我正在按照名爲'thenewboston'的傢伙在YouTube上提供一個教程。 https://www.youtube.com/watch?v=27Fjrlx4s-o&index=2&list=PL6gx4Cwl9DGDi9F_slcQK7knjtO8TUvUs 下面是我使用的代碼。如何在燒瓶中使用url中的變量
from flask import Flask
app = Flask(__name__)
# @ signifies a decorator - way to wrap a function and modifying its behavior
@app.route('/')
def index():
return "this is the homepage"
@app.route('/tuna')
def tuna():
return '<h2> tuna is good</h2>'
@app.route('/profile/<username>')
def profile():
return "hey there %s" % username
if __name__ == "__main__":
app.run()
當我去 http://127.0.0.1:5000/profile/bucky 我得到以下錯誤
內部服務器錯誤
服務器遇到一個內部錯誤,無法完成您的請求。服務器過載或應用程序出現錯誤。