conf.py 文件源码

python
阅读 32 收藏 0 点赞 0 评论 0

项目:cookiecutter-django-app 作者: edx 项目源码 文件源码
def on_init(app):  # pylint: disable=unused-argument
    """
    Run sphinx-apidoc after Sphinx initialization.

    Read the Docs won't run tox or custom shell commands, so we need this to
    avoid checking in the generated reStructuredText files.
    """
    docs_path = os.path.abspath(os.path.dirname(__file__))
    root_path = os.path.abspath(os.path.join(docs_path, '..'))
    apidoc_path = 'sphinx-apidoc'
    if hasattr(sys, 'real_prefix'):  # Check to see if we are in a virtualenv
        # If we are, assemble the path manually
        bin_path = os.path.abspath(os.path.join(sys.prefix, 'bin'))
        apidoc_path = os.path.join(bin_path, apidoc_path)
    check_call([apidoc_path, '-o', docs_path, os.path.join(root_path, '{{ cookiecutter.app_name }}'),
                os.path.join(root_path, '{{ cookiecutter.app_name }}/migrations')])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号