我正在尝试使用蓝图创建一个烧瓶应用程序,因此我有以下结构:
myapp/
__init__.py
static/
templates/
site/
index.html
register.html
layout.html
views/
__init__.py
site.py
models.py
初始化py
^{pr2}$视图/站点.py
from flask import Blueprint, render_template
site = Blueprint('site', __name__)
site.route('/')
def index():
return render_template('site/index.html')
site.route('/register/')
def register():
return render_template('site/register.html')
当我运行这个应用程序,试着去我的任何一条路线时,我唯一的提示是“404找不到”,我真的不知道我做错了什么,因为我做的正是这本书上说的:Explore Flask - Blueprints
提前谢谢。在
您必须像下面这样在
@
前面加上site.route
。在相关问题 更多 >
编程相关推荐