S
S
Sabrjkee2019-07-09 15:12:45
Python
Sabrjkee, 2019-07-09 15:12:45

How to properly configure sphinx so that it sees my files?

I create a dock for my project which lies in /home/projects/dev/gh_project inside the api_middleman folder for which I make a dock in the folder /home/projects/dev/gh_projec/ there are source and build folders in the config I wrote this

# Configuration file for the Sphinx documentation builder.
#
# This file only contains a selection of the most common options. For a full
# list see the documentation:
# http://www.sphinx-doc.org/en/master/config

# -- Path setup --------------------------------------------------------------

# If extensions (or modules to document with autodoc) are in another directory,
# add these directories to sys.path here. If the directory is relative to the
# documentation root, use os.path.abspath to make it absolute, like shown here.
#
import os
import sys
sys.path.insert(0, os.path.abspath('../gh_project'))
sys.path.insert(0, os.path.abspath('/home/projects/dev/gh_project'))
sys.path.insert(0, os.path.abspath('/home/projects/dev/gh_project/api_middleman'))
sys.path.insert(0, os.path.abspath('/home/projects/dev/gh_project/api_middleman/app'))


# -- Project information -----------------------------------------------------

project = 'MIS'

# The full version, including alpha/beta/rc tags
release = '0.0.0.1'


# -- General configuration ---------------------------------------------------

# Add any Sphinx extension module names here, as strings. They can be
# extensions coming with Sphinx (named 'sphinx.ext.*') or your custom
# ones.
extensions = ['sphinx.ext.todo', 'sphinx.ext.viewcode', 'sphinx.ext.autodoc']

# Add any paths that contain templates here, relative to this directory.
templates_path = ['_templates']

# The language for content autogenerated by Sphinx. Refer to documentation
# for a list of supported languages.
#
# This is also used if you do content translation via gettext catalogs.
# Usually you set "language" from the command line for these cases.
language = 'ru'

# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
# This pattern also affects html_static_path and html_extra_path.
exclude_patterns = []


# -- Options for HTML output -------------------------------------------------

# The theme to use for HTML and HTML Help pages.  See the documentation for
# a list of builtin themes.
#
html_theme = 'agogo'

# Add any paths that contain custom static files (such as style sheets) here,
# relative to this directory. They are copied after the builtin static files,
# so a file named "default.css" will overwrite the builtin "default.css".
html_static_path = []

html_show_copyright = False
html_show_sphinx = False

in the /home/projects/dev/gh_project folder I run the sphinx-build source/ build/ command, it works and creates everything I need, but then when I press make html
I get errors in the logs
Running Sphinx v2.1.2
loading translations [ru]... done
making output directory... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 4 source files that are out of date
updating environment: 4 added, 0 changed, 0 removed
reading sources... [100%] modules                                                                                                                                                                                                                                        
WARNING: autodoc: failed to import module 'logger_conf' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'run' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.config' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.logger_conf' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.models' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.routes' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.scheme' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.utils' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.validators' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app.views' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
WARNING: autodoc: failed to import module 'app' from module 'api_middleman'; the following exception was raised:
No module named 'api_middleman'
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] modules                                                                                                                                                                                                                                         
generating indices... genindex
writing additional pages... search
copying static files... done
copying extra files... done
dumping search index in Russian (code: ru) ... done
dumping object inventory... done
build succeeded, 12 warnings.

here's what's in the rst files
.. toctree::

   api_middleman.app

Submodules
----------

api\_middleman.logger\_conf module
----------------------------------

.. automodule:: api_middleman.logger_conf
   :members:
   :undoc-members:
   :show-inheritance:

api\_middleman.run module
-------------------------

.. automodule:: api_middleman.run
   :members:
   :undoc-members:
   :show-inheritance:


Module contents
---------------

.. automodule:: api_middleman
   :members:
   :undoc-members:
   :show-inheritance:

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Sabrjkee, 2019-07-09
@Sabrjkee

in conf.py it was necessary to registersys.path.insert(0, os.path.abspath('../..'))

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question