端点工具窗口
最后修改时间:2023 年 11 月 7 日所需插件:端点
查看 | 工具窗口 | 端点
如果您正在开发Django应用程序或基于Django REST Framework或FastAPI 的API,您可以在Endpoints工具窗口中获取所有声明的 URL 和端点的概述。该工具窗口可以在开发微服务和后端-前端通信时为您提供帮助。它对于使用 RESTful API也很有帮助。


要从端点工具窗口导航到端点声明,请执行以下操作之一:
选择 从端点的上下文菜单跳转到源。
选择端点并按 。F4
双击端点。


要搜索端点声明,请转至导航| 从主菜单中进行 URL 映射或按并从列表中选择相关声明。CtrlShift0\

在端点工具窗口中,您可以按模块、类型和框架过滤端点列表。

笔记
对于 Django,该列表包含符合以下要求的端点:
声明端点的文件的名称包含
url
.端点已在
urlpatterns
变量中声明。端点已使用
path
orre_path
函数声明。端点声明包含对基于类或基于函数的视图的引用。
警告
要浏览库文件中声明的端点,请单击,然后选择“显示从库”。
标记为已弃用的端点带有删除线(划掉)。
工具栏
物品 | 描述 |
---|---|
模块 | 按模块过滤端点或选择外部模块 |
类型 | 按类型过滤端点 |
框架 | 按框架过滤端点 |
配置 OpenAPI 源:添加外部 OpenAPI 规范(例如,来自 SwaggerHub)以在端点工具窗口中包含此规范中的端点,并以黄色背景突出显示它们。在打开的OpenAPI 规范 了解更多信息在 PyCharm 中使用 REST API。 | |
配置工具窗口布局和过滤器:
|
端点详细信息
选择端点后,您可以在专用窗格中查看详细信息。使用或
显示和隐藏详细信息窗格。
显示为选定端点生成的 HTTP 请求。
Django URL 参数包含在双花括号中。
如果相应的服务器正在运行,您可以提交请求以立即查看响应,或者在编辑器中的单独 HTTP 请求文件中打开它。有关详细信息,请参阅HTTP 客户端。

笔记
对于gRPC请求,该选项卡未启用,因为 gRPC API 是通过 .proto 文件定义的。
显示为选定端点生成的 OpenAPI 规范。
You can also generate an OpenAPI specification for an entire module: right-click a module in the Endpoints tool window and select Export Draft of OpenAPI Specification.

To preview the specification in a separate file, click .
Shows the documentation for the HTTP method in the referenced class, function, or method.

感谢您的反馈意见!