19 lines
680 B
Python
19 lines
680 B
Python
from flask import Blueprint
|
|
|
|
# 导入各个路由模块
|
|
from routes.auth import auth
|
|
from routes.classify import classify_bp
|
|
|
|
# 创建注册蓝图的函数
|
|
def register_blueprints(app):
|
|
"""在Flask应用中注册所有蓝图"""
|
|
# 认证相关路由,使用/auth前缀
|
|
app.register_blueprint(auth, url_prefix='/auth')
|
|
|
|
# 分类相关路由,使用/api/classify前缀
|
|
app.register_blueprint(classify_bp) # classify_bp已经在定义时设置了url_prefix='/api/classify'
|
|
|
|
# 打印所有注册的路由(调试用,可选)
|
|
print("已注册的路由:")
|
|
for rule in app.url_map.iter_rules():
|
|
print(f"{rule.endpoint}: {rule.rule}") |