# fastapi_hello_world **Repository Path**: yongfuxie/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**: 0 - **Forks**: 1 - **Created**: 2024-10-18 - **Last Updated**: 2024-10-18 ## 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 cffi==1.15.1 cryptography==43.0.0 fastapi==0.111.1 httptools==0.6.1 PyJWT==2.8.0 python-dotenv==1.0.1 PyYAML==6.0.1 redis==5.0.7 sqlacodegen==2.3.0.post1 watchfiles==0.22.0 websockets==12.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