flask 蓝图相关api 作者:马育民 • 2019-06-18 16:09 • 阅读:10101 # Blueprint 蓝图类 ``` Blueprint(self, name, import_name, static_folder=None,static_url_path=None, template_folder=None,url_prefix=None, subdomain=None, url_defaults=None,root_path=None) ``` ##### 参数 - name:蓝图名,也用于 该蓝图路由的 [end_point ](https://www.malaoshi.top/show_1EF3U5Y2pOJc.html "end_point") - import\_name:同Flask类的```__name__```。目的是 使Flask知道在 当前py文件所在目录下 寻找static、templates文件夹 - static_folder:[同Flask类的参数](https://www.malaoshi.top/show_1EF3U0Iq0XtS.html "同Flask类的参数") - static_url_path:[同Flask类的参数](https://www.malaoshi.top/show_1EF3U0Iq0XtS.html "同Flask类的参数") - template_folder:[同Flask类的参数](https://www.malaoshi.top/show_1EF3U0Iq0XtS.html "同Flask类的参数") - url_prefix:给该蓝图路由的```url```设置前缀 # Flask.register_blueprint() 注册蓝图的方法 ``` def register_blueprint(self, blueprint, **options) ``` ##### 参数 - blueprint:蓝图对象 - \*\*options:有若干参数,如:```url_prefix='/admin'```,设置前缀,功能同```Blueprint```的```url_prefix```(优先级低) 原文出处:http://malaoshi.top/show_1EF3XSDnH4wS.html