添加蓝图
作者:互联网
添加蓝图步骤:
一,导入蓝图:
from flask import Blueprint
二,初始化蓝图:
news_blu = Blueprint('news',__name__,url_prefix='/news')
三,注册路由
1.from . import views
2.创建views文件夹
3.from . import news_blu
@news_blu.route('/index')
def index():
return
四,注册路由
from info.models.news import news_blu
app.register_ blueprint(news_blu)
标签:__,Blueprint,blu,蓝图,添加,import,news 来源: https://www.cnblogs.com/dreamer-zhang/p/10509638.html