Sphinx文档和autodoc-skip-member

mel*_*bic 7 django documentation python-sphinx

我正在通过以下方式为django项目构建我的sphinx文档:

sphinx-apidoc app -o docs/source/app --force
Run Code Online (Sandbox Code Playgroud)

现在它包含了我不想在我的文档中进行的所有南迁移.我现在尝试以下列方式排除它们:

conf.py:
    def skip_migrations(app, what, name, obj, skip, options):
        return skip or (what == 'module' and name.find('Migration') != -1)\ 
               or str(obj).find('migrations') != -1

    def setup(app):
       app.connect('autodoc-skip-member', skip_migrations)
Run Code Online (Sandbox Code Playgroud)

现在它们不再被记录,但仍然列在模块下.我该如何排除它们?

hel*_*hil 5

You may exclude the rst files created for the migrations by adding them to the exclude_pattern in your conf.py file:

exclude_patterns = ["**/*.migrations.rst",]
Run Code Online (Sandbox Code Playgroud)