[英]Testing FastAPI endpoints in the interface
我可以访问包含以下分支的私有 GitLab 项目: main
、 develop
和new_branch
。 机器学习项目非常复杂,包含 NLP 的各种转换器,以及从输入文本生成一些 output 的许多步骤。 也使用了 FastAPI。 我正在使用 Windows。
我按照说明运行pipenv run start
:
←[32mINFO←[0m: Started server process [←[36m12988←[0m]
←[32mINFO←[0m: Waiting for application startup.
←[32mINFO←[0m: Application startup complete.
←[32mINFO←[0m: Uvicorn running on ←[1mhttp://127.0.0.1:8000←[0m (Press CTRL+C to quit)
I go to http://127.0.0.1:8000 and get (though the instructions say to go to http://localhost:8000/):
{"name":"my app API","version":"0.0.1","currentTime":"01/07/2022, 04:41:36"}
在终端:
←[32mINFO←[0m: 127.0.0.1:65248 - "←[1mGET / HTTP/1.1←[0m" ←[32m200 OK←[0m
但是我如何实际使用该应用程序? 我在互联网上看到了一个简单的示例,我在浏览器中导航到端点,但在我的情况下,项目要复杂得多,并且文件夹的树很大。 我在浏览器中的地址之后输入的任何内容都会给我{"detail":"Not Found"}
。
由于 FastAPI 只是一个用于创建 API 的框架,因此没有可用的真实用户界面(除了它生成的文档)。 它不是 web 应用程序 - 只是端点定义的集合。
来自 FastAPI 文档:
如果您想知道应用程序中有哪些端点可用,请尝试转到http://127.0.0.1:8080/docs
或http://127.0.0.1:8080/redoc
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.