[英]Flask Error When I run program
這次我有朋友用英語幫忙。
我有更多的問題,獲得新的加載路線。
我有這個測試代碼:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return render_template('main.html')
@app.route('/order')
def index():
return render_template('order.html')
if __name__ == '__main__':
app.run()
我收到這個錯誤:
View function mapping is overwriting an existing endpoint function: index
請幫我。 我希望英語更好。
您定義index()
兩次。 您必須更改名稱之一的功能。
您在同一范圍內定義了兩次函數index
。 燒瓶裝飾器讓它聽起來更復雜,就是這樣。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.