I am new to sphinx and need help to figure out why I am getting the following error:
WARNING: autodoc: failed to import module 'employe_dao' from module 'models'; the following exception was raised:
No module named 'models'
My project structure is:
|--master_project
|--sub_project
|--docs
|--build
|--conf.py
|--index.rst
|--Makefile
|--models.rst
|--src.models.rst
|--src.rst
|--src
|--models
|--employee.py
...
|--__init__.py
|--data_extractor.py
|--optimiser.py
enter code here
...
This is a snipet from index.rst
...
.. toctree::
:maxdepth: 2
:caption: Contents:
.. automodule::src
:members:
:undoc-members:
:show-inheritance:
.. automodule::models
:members:
:undoc-members:
:show-inheritance:
...
* :ref:`modindex`
I have added sys.path.insert(0, os.path.abspath('./sub_project')) and uncomment import os, import sys in conf.py as recommened in Sphinx: autodoc can`t import module
sphinx-build fail - autodoc can't import/find module @ryandillan suggestion to add sys.path.insert(0, os.path.abspath('..')) to config.py fixed my 404 "index not found" error for model index for index.rst
I have added extensions = ['sphinx.ext.autodoc'] to config.py as recommend in another stackoverflow thread.
Any suggestions on what else I am doing incorrectly?