我正在学习 Sphinx ,以记录我的 Django 项目。
我的项目结构就像
app
|- docs
|- build
|- source
|- conf.py
|- index.rst
|- make.bat
|- Makefile
|- src
|- authentication
|- __init__.py
|- models.py
|- ...
|- myapp
|- __init__.py
|- settings.py
|- wsgi.py
|- manage.py
在“ app / docs / source / conf.py”中,用于查找文档的路径设置为
import os
import sys
sys.path.insert(0, os.path.abspath('../../src'))
和 index.rst 具有内容
App's documentation!
=============================================
.. automodule:: manage
:members:
.. toctree::
:maxdepth: 2
:caption: Contents:
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
正在运行
make html
它会生成空白文档页面,其中包含默认内容,而Django应用程序中没有内容。
我创建了许多应用程序,每个应用程序包含许多文件。我想从整个Django应用程序的文档字符串中自动生成文档。
答案 0 :(得分:0)
看看这个https://medium.com/@sschannak/sphinx-for-django-documentation-2b9c900c6cfa。看起来您缺少django设置,您需要为要记录的项目模块添加.. automodule::
。