2013-03-01 76 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)