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

未完待续。。。。。

相关推荐
喵手11 分钟前
Python爬虫实战:构建各地统计局数据发布板块的自动化索引爬虫(附CSV导出 + SQLite持久化存储)!
爬虫·python·爬虫实战·零基础python爬虫教学·采集数据csv导出·采集各地统计局数据发布数据·统计局数据采集
天天爱吃肉82181 小时前
跟着创意天才周杰伦学新能源汽车研发测试!3年从工程师到领域专家的成长秘籍!
数据库·python·算法·分类·汽车
m0_715575341 小时前
使用PyTorch构建你的第一个神经网络
jvm·数据库·python
甄心爱学习1 小时前
【leetcode】判断平衡二叉树
python·算法·leetcode
深蓝电商API1 小时前
滑块验证码破解思路与常见绕过方法
爬虫·python
Ulyanov1 小时前
Pymunk物理引擎深度解析:从入门到实战的2D物理模拟全攻略
python·游戏开发·pygame·物理引擎·pymunk
sensen_kiss1 小时前
INT303 Coursework1 爬取影视网站数据(如何爬虫网站数据)
爬虫·python·学习
玄同7652 小时前
我的 Trae Skill 实践|使用 UV 工具一键搭建 Python 项目开发环境
开发语言·人工智能·python·langchain·uv·trae·vibe coding
Yorlen_Zhang2 小时前
Python Tkinter Text 控件完全指南:从基础编辑器到富文本应用
开发语言·python·c#
HAPPY酷2 小时前
C++ 和 Python 的“容器”对决:从万金油到核武器
开发语言·c++·python