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

未完待续。。。。。

相关推荐
kusedexingfu几秒前
如何理解python中的闭包
开发语言·python
vv_Ⅸ2 分钟前
打卡day29
python
Laravel技术社区4 分钟前
python3 部署内网离线项目(无网环境)
python
别叫我->学废了->lol在线等5 分钟前
model_validator的mode=“before“
python
高洁019 分钟前
卷积神经网络(CNN)详细介绍及其原理详解(3)
python·神经网络·机器学习·transformer
liwulin050626 分钟前
【ESP32-CAM】在智能小车中,电机和承重的关系
python
hjs_deeplearning28 分钟前
应用篇#4:Qwen2视觉语言模型(VLM)的服务器部署
服务器·人工智能·python·深度学习·语言模型
花开花富贵33 分钟前
Python 温度数据处理与可视化全流程:从读取到保存1.2
python
荒野火狐41 分钟前
【强化学习】关于PPO收敛问题
python·深度学习·机器学习·强化学习
江上鹤.14842 分钟前
Day 28 复习日
人工智能·python·机器学习