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

未完待续。。。。。

相关推荐
luoluoal1 分钟前
基于深度学习的web端多格式纠错系统(源码+文档)
python·mysql·django·毕业设计·源码
深蓝海拓8 分钟前
PySide6从0开始学习的笔记(二十七) 日志管理
笔记·python·学习·pyqt
天天进步201516 分钟前
Python全栈项目:实时数据处理平台
开发语言·python
Tipriest_17 分钟前
Python中is关键字详细说明,比较的是地址还是值
开发语言·python
sheji341618 分钟前
【开题答辩全过程】以 基于Python的餐饮统计系统的设计和实 现为例,包含答辩的问题和答案
开发语言·python
遨游xyz30 分钟前
排序-快速排序
开发语言·python·排序算法
iFeng的小屋41 分钟前
【2026年新版】Python根据小红书关键词爬取所有笔记数据
笔记·爬虫·python
m0_5613596743 分钟前
使用Python处理计算机图形学(PIL/Pillow)
jvm·数据库·python
LeonDL16843 分钟前
基于YOLO11深度学习的衣物识别系统【Python源码+Pyqt5界面+数据集+安装使用教程+训练代码】【附下载链接】
人工智能·python·pyqt5·yolo数据集·yolo11数据集·yolo11深度学习·衣物识别系统
傻啦嘿哟1 小时前
Python操作PDF页面详解:删除指定页的完整方案
开发语言·python·pdf