FastAPI项目

一个使用uvicorn作为ASGI服务器的简单FastAPI项目,提供API开发与测试功能。

  • by niting007
  • Python
  • 本地部署
  • 更新于
在 GitHub 查看 niting007/mcpserver

使用说明

FastAPI项目

这是一个简单的FastAPI项目,它使用 uvicorn 作为ASGI服务器。

先决条件

  • Python 3.7或更高版本
  • pip (Python包管理器)
  • 所需的Python库:
    • fastapi
    • uvicorn

安装

  1. 克隆存储库:

    git clone <repository-url>
    cd <repository-folder>
    
    
  2. 创建虚拟环境:

python3-m venv-venv 源venv/bin/activate

  1. 安装依赖项:

pip安装-r要求.txt

运行应用程序

  1. 使用uvicorn启动FastAPI应用程序:

uvicorn主:应用程序--reload

如果不同,请用正确的模块和应用程序实例替换main:app。

  1. 打开浏览器并导航到:

http://127.0.0.1:8000

  1. 访问API交互式文档:

http://127.0.0.1:8000/docs

测试API 使用curl、Postman或/docs内置的Swagger UI等工具来测试API端点。

许可证 该项目根据MIT许可证获得许可。