【发布时间】:2016-05-02 06:26:15
【问题描述】:
我有一个烧瓶应用程序,我想使用 Sphinx 的 autoflask 指令来记录烧瓶休息 API。
https://pythonhosted.org/sphinxcontrib-httpdomain/#module-sphinxcontrib.autohttp.flask
我已经通过 pip 安装了模块并运行 sphinx-quickstart,它给了我一个 conf.py 和 index.rst。
我已经尝试将扩展放入 conf.py:
extensions = ['sphinxcontrib.autohttp.flask']
并根据文档将指令放入 index.rst:
.. autoflask:: autoflask_sampleapp:app
:undos-static:
但我无法正确获取 app:module (autoflask_sampleapp:app) 部分。结果,当我运行 sphinx-build 时,我收到一个错误,即找不到应用程序或模块。
我的应用树如下所示:
.
├── admin
├── apis
├── app
│ ├── static
│ └── templates
从应用的根目录,我可以说:
from apis import profile
如何在 index.rst 中配置 auto flask 以正确查找和加载我的应用的 API 模块?
【问题讨论】:
-
autoflask_sampleapp来自哪里?它似乎不在您的“应用程序树”中。
标签: python flask python-sphinx flask-restful