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

未完待续。。。。。

相关推荐
0566463 小时前
agent学习Day15——SQLAlchemy 查询过滤、分页与历史列表接口
python·学习·fastapi
程序员爱德华4 小时前
Python与C++:异同点对比
c++·python
hangyuekejiGEO4 小时前
GEO技术服务选型指南
大数据·人工智能·python
软萌萌的15 小时前
Java Spring Boot 修改yml配置&加载顺序规则
java·spring boot·python
Dxy12393102166 小时前
Linux 编译安装 Python 3.12.10(多版本共存,不破坏系统Python)
linux·运维·python
持敬chijing7 小时前
Python概述
开发语言·python
赤羽尾风9 小时前
NumPy快速入门
python·numpy
倒流时光三十年9 小时前
第三阶段 26 · highlight 高亮(返回命中片段)
后端·python·django
久久学姐10 小时前
Python+Playwright+Pytest+BDD,用FSM打造高效测试框架
python·pytest·bdd·playwright·fsm