2013-03-01 43 views
1

我按照http://flask.pocoo.org/docs/blueprints/#blueprints中的说明尝试在除创建应用程序对象的脚本之外的其他脚本中执行路由。但我的错误是无法使用蓝图进行路由烧瓶

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

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

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

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

请启用调试运行你的应用程序(' app.run(debug = True)')并在此处发布回溯。 – 2013-03-01 14:44:49

+0

雅,用你的app.run(debug = True)调试技巧,我可以自己排除错误。通过这个调试,我发现蓝图不会被忽略,但问题出在模块内。然后用这种调试技术在日志中打印出来。非常感谢你 。 – 2013-03-04 06:27:31

回答

1

假设你的蓝图是在一个名为restservice.py,你需要在文件中添加这些行,你所创建的应用程序对象

from restservice import restservice as restModule 
app.register_blueprint(restModule)