# xndc-fastapi **Repository Path**: gideshi/xndc-fastapi ## Basic Information - **Project Name**: xndc-fastapi - **Description**: 虚拟电厂的后端代码管理处 - **Primary Language**: Python - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 2 - **Created**: 2025-08-24 - **Last Updated**: 2025-08-24 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 技术栈 1. fastapi 2. alembic(用于数据库迁移) 3. SQLAlchemy(用于数据库orm) 4. Redis(用于存储登录信息和设备实时信息) 5. Mysql(用于存储数据) # 目录结构 ``` . ├── alembic # 数据库迁移 ├── app # 南向接口程序 │   ├── db # 数据库操作(redis 和 mysql) │   ├── middlewares # 中间件 │   ├── models # 数据库模型 │   ├── router # 路由 │   ├── schemas # 数据模型 │   └── utils # 工具 ├── common # 公共模块 ├── device # 设备端程序 │   ├── router # 路由 │   └── utils # 工具 ├── json # 南向接口程序使用到的json文件 ├── logs # 日志 ├── main.py # 南向程序 main ├── light_control.py # 小灯设备 main ├── dlt645_detect.py # 电表设备 main ├── generate_json.py # 生成json文件,用于南向程序 ├── setup.py # 编译 so/pyd 文件 ├── setup_main.py # 编译 so/pyd 文件 main ├── dev.sh # 运行南向程序 ├── install.sh # 安装环境 ├── migrate.sh # 数据库迁移 ├── alembic.ini # alembic 配置文件 └── readme.md ``` # 环境安装 需要手动安装 mysql 和 redis,并将配置文件写入`.env`文件中,具体可参考`.env.example`文件。 ```shell ./install.sh ``` # 运行 ## 南向程序 将配置文件写入`.env`文件中,具体可参考`.env.example`文件。 ```shell ./dev.sh ``` ## 小灯程序 需要将配置文件写入`.env.device.light`文件中,具体可参考`.env.device.example`文件。 ```shell python light_control.py ``` ## 电表程序 需要将配置文件写入`.env.device.dlt645`文件中,具体可参考`.env.device.example`文件。 ```shell python dlt645_detect.py ``` # 编译 so/pyd 文件 ```shell python setup_main.py ```