首页 > 解决方案 > 狮身人面像不捕捉码头字符串

问题描述

我尝试使用 sphinx 制作文档

我使用sphinx-apidoc -f -o source/ ../ 然后make html 它为我创建了文档,但是这个文档不包括文件中的停靠字符串

我使用相同的码头字符串:

def send_confirm_msg(self, token, email, legal_type):
    """
    Отсылает письмо с потверждением
    :param token: токен потверждения
    :param email: емаил на который придёт ссылка
    :return: None
    """

我的会议

# 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('../'))
# sys.path.insert(0, os.path.abspath('/home/projects/gh_project/'))
# sys.path.insert(0, os.path.abspath('/home/projects/gh_project/package'))
# sys.path.insert(0, os.path.abspath('/home/projects/gh_project/api_middleman/app'))
# sys.path.insert(0, os.path.abspath('/home/projects/gh_project/api_middleman/db_create'))


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

project = 'MIS'
copyright = '2019, ICode'
author = 'ICode'

# 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

首先

gh\_project.api\_legal.app.views module
---------------------------------------

.. automodule:: gh_project.api_legal.app.views
   :members:
   :undoc-members:
   :show-inheritance:

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

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

但结果我看到这个https://imgur.com/jyYeqlK没有任何停靠字符串它不缓存任何停靠字符串如何解决这个问题我在 def 函数中使用的所有停靠字符串可能有问题?

标签: python-3.xpython-sphinx

解决方案


在 conf.py 中有必要添加sys.path.insert(0, os.path.abspath('../..'))


推荐阅读