Anuj TBE
Anuj TBE

Reputation: 9826

Sphinx automodule: failed to import module

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.

Upvotes: 1

Views: 378

Answers (1)

Krukas
Krukas

Reputation: 677

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.

Upvotes: 1

Related Questions