@Sabrjkee

Как правильно настроить sphinx чтобы он увидел мои файлы?

я создаю доку для своего проекта которая лежит в /home/projects/dev/gh_project внутри папка api_middleman для которой я и делаю доку в папке /home/projects/dev/gh_projec/ лежат папки source и build в конфиге я прописал это
# 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


в папке /home/projects/dev/gh_project запускаю команду sphinx-build source/ build/ он отрабатывает и все что нужно создает но потом когда я жму make html
у меня в логах летят ошибки
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.


вот что в rst файлах
.. 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:
  • Вопрос задан
  • 1303 просмотра
Решения вопроса 1
@Sabrjkee Автор вопроса
в conf.py надо было прописатьsys.path.insert(0, os.path.abspath('../..'))
Ответ написан
Комментировать
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Похожие вопросы