# FastApiStudy **Repository Path**: shallowdreambreezeling/fastapistudy ## Basic Information - **Project Name**: FastApiStudy - **Description**: No description available - **Primary Language**: Python - **License**: Not specified - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2023-11-08 - **Last Updated**: 2023-11-14 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # 一、简介 > FastAPI 的小demo # 二、快速上手 ## 1. 下载代码 ```shell git clone https://gitee.com/shallowdreambreezeling/fastapistudy.git ``` ## 2. 创建python虚拟环境 > 本项目使用的是 python3.11,推荐也用这个版本 >打开下载好的fastapistudy文件夹,打开终端,安装virtualenv: ```shell cd fastapistudy pip install -i https://pypi.tuna.tsinghua.edu.cn/simple virtualenv ``` > 创建一个虚拟环境,取名为venv: ```shell virtualenv venv ``` > 在 Windows 系统上面使用 virtualenv: ```shell venv\Scripts\activate ``` > 在 Linux 上使用 virtualenv Linux 上面进入虚拟环境的方式跟 Windows 稍微有点不同,可以直接使用命令来进入,直接输入以下命令就可以进入虚拟环境: ```shell source venv/bin/activate ``` ## 3. 安装依赖 ```shell cd fastapistudy pip install -r requirements.txt ``` ## 4. 运行项目 > 启动服务,默认 localhost:8000 ```shell uviconrn main:app ``` > 在浏览器中输入以下 URL,自动生成交互式文档。 ```shell http://127.0.0.1:8000/docs ``` 可以看到内部执行的Curl命令,请求URL,响应头,以及服务器响应的JSON格式。