1

I'm learning Sphinx to document my Django project.

My project structure is like

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

in the `app/docs/source/conf.py, the path to find doc is set as

import os
import sys
sys.path.insert(0, os.path.abspath('../../src'))

and index.rst has content

App's documentation!
=============================================

.. automodule:: manage
   :members:

.. toctree::
   :maxdepth: 2
   :caption: Contents:



Indices and tables
==================

* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`

on running

make html

It generates blank documentation page with default content and no content from the Django application.

I have many applications created and each application contains many files. I want to auto-generate documentation from the docstring throughout the Django application.

barryhunter
  • 20,886
  • 3
  • 30
  • 43
Anuj TBE
  • 9,198
  • 27
  • 136
  • 285

1 Answers1

1

Take a look at this https://medium.com/@sschannak/sphinx-for-django-documentation-2b9c900c6cfa. It's look like you are missing the django setup and you need to add .. automodule:: for you project modules that you want to document.

Krukas
  • 657
  • 3
  • 10
  • Thanks. But can I automate documenting all files of the app included in `INSTALLED_APPS` list? There are lot of files and it will be difficult adding all views, models, etc separately. – Anuj TBE Jun 19 '19 at 12:42
  • I have never used it, but take a look at https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html – Krukas Jun 19 '19 at 12:50