【问题标题】:Generate a API Code Documentation using python and host in web server?使用 python 生成 API 代码文档并在 Web 服务器中托管?
【发布时间】:2018-05-29 05:41:37
【问题描述】:

我在文件夹 mvc 结构中有一个 Python 项目。我是 Python 代码文档的新手。我想知道如何生成index.html 并使用 app.route 结构在网络中发布,例如

localhost:9000/docs -> 我应该得到项目类和方法以及 cmets。

如何使用 Python 库为我的 Python 项目启动它。我不想使用任何设置工具。

sphinx-apidoc - ??

我试过了

 pythoncode\sphinxapidoctry\python_project\docs>sphinx-apidoc -f -A "Author" -H "Test project" -V "version 1.0" -R "release 2014" -F -d 4 -e -P -o docs pythoncode/sphinxapidoctry/python_project

 cd docs> make html

然后我得到了 autodoc 无法导入之类的错误

WARNING: autodoc: failed to import module 'api'; the following exception was raised:
No module named 'api'
  my folder structure->
     python_project->
        api=>
           endpoints->
               account.py
               tents.py

我的帐户.py ->

def authenticateAndAuthorize(request):

"""
This function take two args

:param arg1: Some value
:param arg2: another val

:return: arg1
"""
if request.authorization:

【问题讨论】:

  • 请把你的问题说得更清楚,这样可以帮助你快速找到答案。
  • @RedBoy,按照你说的完成,请帮我解决错误,我得到了 html 文件,但在 account.py 中我没有在 py 文件中写入 cmets。附上图片以供参考

标签: python python-sphinx


【解决方案1】:

你可以使用pdoc:

$ pdoc --http :9000 python_project

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2015-10-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-08-13
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多