# -*- coding: utf-8 -*- from application import app from controllers.index import index_page from flask_debugtoolbar import DebugToolbarExtension from controllers.member import member_page # 添加debug tool toolbar = DebugToolbarExtension(app) ''' 拦截器处理 和 错误处理器 ''' from interceptors.Auth import * from interceptors.errorHandler import * app.register_blueprint(index_page, url_prefix="/") app.register_blueprint(member_page, url_prefix="/member") ''' 模板函数 ''' from common.lib.UrlManager import UrlManager app.add_template_global(UrlManager.buildStaticUrl, 'buildStaticUrl') app.add_template_global(UrlManager.buildUrl, 'buildUrl')
from application import app from controller.index import index_page from controller.member import member # from flask_debugtoolbar import DebugToolbarExtension @app.route('/') def hello(): return "I love Flask" '请求拦截 错误处理' from intercentors.auth import * from intercentors.error import * # toolbar = DebugToolbarExtension(app) app.register_blueprint(index_page, url_prefix='/') app.register_blueprint(member, url_prefix='/user') '''函数模板''' from common.lib.url_manger import UrlManager app.add_template_global(UrlManager.build_static_url, 'build_static_url') app.add_template_global(UrlManager.build_url, 'build_url')
# -*- coding: utf-8 -*- from application import app from flask_debugtoolbar import DebugToolbarExtension toolbar = DebugToolbarExtension(app) ''' 拦截器处理 和 错误处理器 ''' from interceptors.Auth import * from interceptors.errorHandler import * ''' 蓝图引入 ''' from controllers.index import index_page from controllers.member import member_page from controllers.logged import logged_page from controllers.news_api import route_api from controllers.cars_api import cars_api app.register_blueprint(index_page, url_prefix="/") app.register_blueprint(member_page, url_prefix="/member") app.register_blueprint(logged_page, url_prefix="/logged") app.register_blueprint(route_api, url_prefix="/api") app.register_blueprint(cars_api, url_prefix="/cars_api") ''' 模板函数,全局注入 ''' from common.libs.UrlManager import UrlManger app.add_template_global(UrlManger.buildUrl, "buildUrl") app.add_template_global(UrlManger.buildStaticUrl, "buildStaticUrl")
from controllers.index import index_page from application import app from flask_debugtoolbar import DebugToolbarExtension from controllers.member import member_page toolbar = DebugToolbarExtension(app) app.register_blueprint(index_page, url_prefix='/') app.register_blueprint(member_page, url_prefix='/member') from interceptors.Auth import * from interceptors.errorsHunter import * from common.libs.urlManager import urlManager app.add_template_global(urlManager.buildStaticURL, 'buildStaticURL') app.add_template_global(urlManager.buildURL, 'buildURL')
''' from application import app from common.components.helper.StaticPluginsHelper import StaticPluginsHelper from common.components.helper.UtilHelper import UtilHelper from common.services.GlobalUrlService import GlobalUrlService from common.services.CommonConstant import CommonConstant ''' toolbar ''' # from flask_debugtoolbar import DebugToolbarExtension # toolbar = DebugToolbarExtension(app) ''' 函数模板 ''' app.add_template_global(GlobalUrlService, 'GlobalUrlService') app.add_template_global(StaticPluginsHelper, 'StaticPluginsHelper') app.add_template_global(UtilHelper, 'UtilHelper') app.add_template_global(CommonConstant, 'CommonConstant') ''' 统一拦截处理和统一错误处理 ''' from web.interceptors.AuthHome import * from web.interceptors.AuthWWW import * from web.interceptors.ErrorHandler import * ''' 蓝图功能,对所有的url进行蓝图功能配置 ''' from web.controllers.route import *