【发布时间】:2011-08-14 00:08:45
【问题描述】:
所以我只是有点困惑如何用烧瓶构建页面而不必说明每个视图。
如何制作一个蓝图,以便在我要加载的页面上获取?
说这些是我的示例页面
templates/
layout.html
section1/
subsection/index.html
subsection2/index.html
section2
subsection/index.html
childofsubsection/index.html
我想假设如果我访问 example.com/section1/subsection/,它会知道查找相应的页面,而无需特别说明。文档http://flask.pocoo.org/docs/blueprints/ 非常接近解释这一点,但我还是有点迷茫。
from flask import Flask
from yourapplication.simple_page import simple_page
app = Flask(__name__)
app.register_blueprint(simple_page)
另外,不知道这应该去哪里?这看起来像是在 application.py 中,但要求从“yourapplication”导入
对烧瓶非常陌生,也不是 python 专家。真的只需要一些愚蠢的:)
【问题讨论】: