{"id":19755189,"url":"https://github.com/fastapi-practices/fastapi_sqlalchemy_mysql","last_synced_at":"2025-04-04T21:08:28.645Z","repository":{"id":38351113,"uuid":"471917984","full_name":"fastapi-practices/fastapi_sqlalchemy_mysql","owner":"fastapi-practices","description":"fastapi + pydantic-v2 + sqlalchemy 2.0 + alembic + mysql + redis","archived":false,"fork":false,"pushed_at":"2025-03-11T05:54:34.000Z","size":225,"stargazers_count":172,"open_issues_count":2,"forks_count":34,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-28T20:11:39.182Z","etag":null,"topics":["fastapi","fastapi-template"],"latest_commit_sha":null,"homepage":"https://fastapi-practices.github.io/fastapi_best_architecture_docs/guide/summary/fsm.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fastapi-practices.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":".github/FUNDING.yml","license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null},"funding":{"custom":"https://wu-clan.github.io/sponsor/"}},"created_at":"2022-03-20T08:13:58.000Z","updated_at":"2025-03-28T10:24:39.000Z","dependencies_parsed_at":"2023-02-18T06:01:23.113Z","dependency_job_id":"7d57e97b-88d0-4c7f-bd40-698b09fdd8d9","html_url":"https://github.com/fastapi-practices/fastapi_sqlalchemy_mysql","commit_stats":null,"previous_names":["wu-clan/fastapi_sqlalchemy_mysql","fastapi-practices/fastapi_sqlalchemy_mysql"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastapi-practices%2Ffastapi_sqlalchemy_mysql","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastapi-practices%2Ffastapi_sqlalchemy_mysql/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastapi-practices%2Ffastapi_sqlalchemy_mysql/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fastapi-practices%2Ffastapi_sqlalchemy_mysql/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fastapi-practices","download_url":"https://codeload.github.com/fastapi-practices/fastapi_sqlalchemy_mysql/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247249526,"owners_count":20908212,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["fastapi","fastapi-template"],"created_at":"2024-11-12T03:09:22.225Z","updated_at":"2025-04-04T21:08:28.628Z","avatar_url":"https://github.com/fastapi-practices.png","language":"Python","readme":"# FastAPI SQLAlchemy MySQL\n\n## 本地开发\n\n* Python 3.10+\n* Mysql 8.0+\n* Redis 推荐最新稳定版\n\n1. 安装依赖项\n\n   ```shell\n   pip install -r requirements.txt\n   ```\n\n2. 创建一个数据库 `fsm`, 选择 `utf8mb4` 编码\n3. 安装启动 Redis\n4. 进入 backend 目录\n\n   ```shell\n   cd backend\n   ```\n\n5. 创建一个 `.env` 文件\n\n   ```shell\n   touch .env\n   cp .env.example .env\n   ```\n\n6. 按需修改配置文件 `core/conf.py` 和 `.env`\n7. 数据库迁移 [alembic](https://alembic.sqlalchemy.org/en/latest/tutorial.html)\n\n    ```shell\n    # 生成迁移文件\n    alembic revision --autogenerate\n    \n    # 执行迁移\n    alembic upgrade head\n    ```\n\n8. 启动 fastapi 服务\n\n   ```shell\n   # 帮助\n   fastapi --help\n   \n   # 开发模式\n   fastapi dev main.py\n   ```\n\n9. 浏览器访问: http://127.0.0.1:8000/docs\n\n---\n\n### Docker\n\n1. 进入 `docker-compose.yml` 文件所在目录，创建环境变量文件 `.env`\n\n   ```shell\n   cd deploy/docker-compose/\n   \n   cp .env.server ../../backend/.env\n   ```\n\n2. 执行一键启动命令\n\n   ```shell\n   # 根据情况使用 sudo\n   docker-compose up -d --build\n   ```\n\n3. 等待命令自动完成\n4. 浏览器访问：http://127.0.0.1:8000/docs\n\n## 赞助\n\n如果此项目能够帮助到你，你可以赞助作者一些咖啡豆表示鼓励：[:coffee: Sponsor :coffee:](https://wu-clan.github.io/sponsor/)\n\n## 许可证\n\n本项目根据 MIT 许可证的条款进行许可\n","funding_links":["https://wu-clan.github.io/sponsor/"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastapi-practices%2Ffastapi_sqlalchemy_mysql","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffastapi-practices%2Ffastapi_sqlalchemy_mysql","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffastapi-practices%2Ffastapi_sqlalchemy_mysql/lists"}