Flask项目中使用蓝湖实现启动项配置——多个controller项

项目结构

python 复制代码
# controller1-__init__.py
from flask import Blueprint

cont2_sale_blueprint = Blueprint('cont2_sale_blueprint', __name__)
cont2_user_blueprint = Blueprint('cont2_user_blueprint', __name__)
from . import user_controller
from . import sale_controller
python 复制代码
# controller1-sale_controller
from flask import jsonify,current_app
from . import cont1_sale_blueprint


@cont1_sale_blueprint.route('/api/sample111', methods=['GET'])
def sample_route1():
    return jsonify({'message': 'Hello, this is a sample route1!'})


@cont1_sale_blueprint.route('/api/sample1111', methods=['GET'])
def sample_route2():
    return jsonify({'message': 'Hello, this is a sample route11!'})
python 复制代码
# controller1-user_controller
from flask import jsonify,current_app
from . import cont1_user_blueprint


@cont1_user_blueprint.route('/api/sample1', methods=['GET'])
def sample_route1():
    return jsonify({'message': 'Hello, this is a sample route1!'})


@cont1_user_blueprint.route('/api/sample11', methods=['GET'])
def sample_route2():
    return jsonify({'message': 'Hello, this is a sample route11!'})

未完待续。。。。。

相关推荐
quikai198117 小时前
python练习第二组
开发语言·python
熊猫_豆豆18 小时前
python 用手势控制程序窗口文字大小
python·手势识别
测试秃头怪18 小时前
2026最新软件测试面试八股文(含答案+文档)
自动化测试·软件测试·python·功能测试·测试工具·面试·职场和发展
LUU_7918 小时前
Day29 异常处理
python
子夜江寒18 小时前
Python 学习-Day8-执行其他应用程序
python·学习
背心2块钱包邮18 小时前
第7节——积分技巧(Integration Techniques)-代换积分法
人工智能·python·深度学习·matplotlib
一个散步者的梦19 小时前
一键生成数据分析报告:Python的ydata-profiling模块(汉化)
python·数据挖掘·数据分析
黑客思维者19 小时前
Python大规模数据处理OOM突围:从迭代器原理到TB级文件实战优化
开发语言·python·github·迭代器·oom
weixin_4211334120 小时前
应用日志监控
python
CHANG_THE_WORLD21 小时前
Python 学习三 Python字符串拼接详解
开发语言·python·学习