<分区> 分区>
这真的很奇怪,但我正面临这个问题。一切正常,我几乎用完了应用程序,但突然间它停止了。我已经隔离了代码,我意识到当我注册一个蓝图并在路线上使用它时,它无法返回说没有找到 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()
