运行 外部服务器中的 pydocs - Python

Running pydocs in a external server - Python

我有一个项目,我想将其文档保存在外部服务器上。 我知道我会 pydoc -p 5000 我会在 http://localhost:5000/ 上找到我的文档。但是我计划在 EC2 实例上托管该文档,作为每个人都可以访问的外部服务器。 假设机器的 IP 地址是 10.10.10.10,它完全可以配置为可以从外部访问。 如何让我的服务器从外部 pydoc 到 运行?

作为 docs 状态:

Specifying a -w flag before the argument will cause HTML documentation to be written out to a file in the current directory, instead of displaying text on the console.

因此,使用 -w 标志将文档写入文件,然后您可以将其复制到您的服务器并将其作为静态文件提供。例如,命令 pydoc -w somelib 将写入一个文件 somelib.html,其中包含 somelib 的文档。将其复制到您服务器的根目录,它将在 http://10.10.10.10/somelib.html 可用(假设您的服务器配置正确)。

此功能将在 3.7 版本中添加。

Documentation.

版本 3.7 中的更改:添加了 -n 选项。