# fastapi_hello_world **Repository Path**: cai-xinpenge/fastapi_hello_world ## Basic Information - **Project Name**: fastapi_hello_world - **Description**: 基于 fastapi 的开发模板,拥有动态加载路由、中间件的功能,自定义了 websocket 装饰器,集成 aioredis, sqlalchemy, celery 等,能够快速搭建 api 接口 - **Primary Language**: Unknown - **License**: Not specified - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 1 - **Forks**: 1 - **Created**: 2024-08-26 - **Last Updated**: 2025-03-21 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # fastapi_hello_world #### 介绍 基于 fastapi 的开发模板,拥有动态加载路由、中间件的功能,自定义了 websocket 装饰器,集成 aioredis, sqlalchemy, celery 等,能够快速搭建 api 接口 #### 软件架构 "aiomysql>=0.2.0", "aioredis>=2.0.1", "celery>=5.4.0", "cryptography>=44.0.2", "fastapi>=0.115.11", "pyjwt>=2.9.0", "python-multipart>=0.0.20", "pyyaml>=6.0.2", "sqlacodegen>=2.3.0.post1", "uvicorn>=0.33.0", #### 安装教程 1. 创建并激活虚拟环境 ```shell mkdir xxx cd xxx python -m venv env source env/bin/activate ``` 2. 安装依赖 ```shell pip install -r requirements.txt ``` 3. 启动 Redis ```shell sudo docker start redis ``` 4. 启动 MySQL ```shell sudo docker start mysql ``` 5. 初始化数据库 ```shell # 复制数据库文件到 mysql 容器 sudo docker cp ./database/database.sql mysql:/ # 进入 mysql 容器 sudo docker exec -it mysql mysql -uroot -p # 创建数据库 create database hello_world; # 执行数据库初始化脚本 source /database.sql; ``` 6. 编写 appliction.yml 文件 ```shell cp application_template.yml application.yml ``` 7. 启动服务 python main.py #### 参与贡献 1. Fork 本仓库 2. 新建 Feat_xxx 分支 3. 提交代码 4. 新建 Pull Request