1

我按照http://flask.pocoo.org/docs/blueprints/#blueprints中的说明操作,并尝试在我创建应用程序对象的脚本之外的另一个脚本中进行路由。但我得到错误

“服务器遇到内部错误,无法完成您的请求。服务器过载或应用程序出错。”

它只是忽略了我在该脚本中所做的路由。

restservice = Blueprint('restservice', __name__,template_folder='templates')

@restservice.route('/')
def approot():
   render_template('timeline.html')
4

1 回答 1

1

假设您的蓝图位于名为 restservice.py 的文件中,您需要在创建应用程序对象的文件中添加这些行

from restservice import restservice as restModule
app.register_blueprint(restModule)
于 2013-03-03T12:02:04.093 回答