0
這真的很奇怪,但我正面臨着這個問題。一切正常,我幾乎完成了應用程序,但突然間它停了下來。我已經隔離了代碼,我意識到,當我註冊藍圖並在路線上使用它時,它無法返回說找不到URL。以下是隔離代碼:使用藍圖時未找到燒瓶URL
from flask import Flask, render_template, Blueprint
app = Flask(__name__)
home = Blueprint('home', __name__, static_folder='static', template_folder='template')
app.register_blueprint(home)
@home.route('/') #<---This one does not work
# @app.route('/') <--- This one works
def index():
return "This is the index route."
# return render_template('layer.html')
if __name__ == '__main__':
app.run()