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!'})

未完待续。。。。。

相关推荐
MediaTea29 分钟前
Python:模块 __dict__ 详解
开发语言·前端·数据库·python
jarreyer35 分钟前
python,numpy,pandas和matplotlib版本对应关系
python·numpy·pandas
代码or搬砖1 小时前
HashMap源码
开发语言·python·哈希算法
顽强卖力2 小时前
第二章:什么是数据分析师?
笔记·python·职场和发展·学习方法
站大爷IP3 小时前
Python实现Excel数据自动化处理:从繁琐操作到智能流程的蜕变
python
BBB努力学习程序设计3 小时前
Python 进阶知识点精讲:上下文管理器(Context Manager)的原理与实战
python·pycharm
清水白石0083 小时前
《深入 super() 的世界:MRO 与 C3 线性化算法的全景解析与实战指南》
python
大厂技术总监下海3 小时前
Python 开发者的“新引擎”:Rust 编写的解释器,性能与安全兼得
python·开源
Swizard4 小时前
别再硬编码配置了!5分钟带你用 PyYAML 让 Python 项目“活”起来
python
love530love4 小时前
Windows 下 Z-Image-Turbo 专业版 Gradio 生成器实战:功能增强全记录
人工智能·windows·python·大模型·gradio·博客之星·z-image