Python “独立的源目录和构建目录”是什么意思?
我第一次尝试使用斯芬克斯。我正在运行sphinx quickstart,但不明白要问的第一个问题:Python “独立的源目录和构建目录”是什么意思?,python,python-3.x,python-sphinx,Python,Python 3.x,Python Sphinx,我第一次尝试使用斯芬克斯。我正在运行sphinx quickstart,但不明白要问的第一个问题: > Separate source and build directories (y/n) [n]: 这是什么意思?这些目录是否分开有什么区别?我如何知道选择哪一个?简单地说,选择“从工具的构建中分离源”将导致两种可能的目录/文件结构布局: 如果选择“是”进行分隔,将得到一个生成目录和一个源目录: 生成的.rst文件和conf.py将放在源目录中,然后您编写的任何.rst文件也应放在那里
> Separate source and build directories (y/n) [n]:
这是什么意思?这些目录是否分开有什么区别?我如何知道选择哪一个?简单地说,选择“从工具的构建中分离源”将导致两种可能的目录/文件结构布局:
如果选择“是”进行分隔,将得到一个生成目录和一个源目录:
生成的.rst文件和conf.py将放在源目录中,然后您编写的任何.rst文件也应放在那里。最终的文档文件HTML(例如Sphinx将从StructuredText源文件生成)放置在构建目录中
C:.
│ make.bat
│ Makefile
│
├───build
└───source
│ conf.py
│ index.rst
│
├───_static
└───_templates
下面是运行sphinx快速启动工具的一段摘录,选择“是”将源代码与生成代码分开:
Creating file C:\Your_Project\docs\source\conf.py.
Creating file C:\Your_Project\docs\source\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
Separate source and build directories (y/n) [n]:
Creating file C:\Your_Project\docs\conf.py.
Creating file C:\Your_Project\docs\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
如果选择“否”不分离,则不会创建源目录,因此选择“分离源”选项放置在源目录中的内容将被放置在运行sphinx quickstart的基本目录中
此外,构建目录将略有不同,现在名称中有一个下划线构建:
C:.
│ conf.py
│ index.rst
│ make.bat
│ Makefile
│
├───_build
├───_static
└───_templates
下面是运行sphinx快速启动工具选择“否”以将源代码与构建分离的摘录:
Creating file C:\Your_Project\docs\source\conf.py.
Creating file C:\Your_Project\docs\source\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
Separate source and build directories (y/n) [n]:
Creating file C:\Your_Project\docs\conf.py.
Creating file C:\Your_Project\docs\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
我怎么知道该选哪一个
我看到的普遍选择是选择将源代码与构建代码分开。将文件分开可以使更大的项目更有条理。唯一的缺点是,您将拥有更多的目录,这在一开始可能会让人感到困惑,但从长远来看,增加的分离往往是值得的。简单地说,选择“从工具的构建中分离源”将导致两种可能的目录/文件结构布局:
如果选择“是”进行分隔,将得到一个生成目录和一个源目录:
生成的.rst文件和conf.py将放在源目录中,然后您编写的任何.rst文件也应放在那里。最终的文档文件HTML(例如Sphinx将从StructuredText源文件生成)放置在构建目录中
C:.
│ make.bat
│ Makefile
│
├───build
└───source
│ conf.py
│ index.rst
│
├───_static
└───_templates
下面是运行sphinx快速启动工具的一段摘录,选择“是”将源代码与生成代码分开:
Creating file C:\Your_Project\docs\source\conf.py.
Creating file C:\Your_Project\docs\source\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
Separate source and build directories (y/n) [n]:
Creating file C:\Your_Project\docs\conf.py.
Creating file C:\Your_Project\docs\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
如果选择“否”不分离,则不会创建源目录,因此选择“分离源”选项放置在源目录中的内容将被放置在运行sphinx quickstart的基本目录中
此外,构建目录将略有不同,现在名称中有一个下划线构建:
C:.
│ conf.py
│ index.rst
│ make.bat
│ Makefile
│
├───_build
├───_static
└───_templates
下面是运行sphinx快速启动工具选择“否”以将源代码与构建分离的摘录:
Creating file C:\Your_Project\docs\source\conf.py.
Creating file C:\Your_Project\docs\source\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
Separate source and build directories (y/n) [n]:
Creating file C:\Your_Project\docs\conf.py.
Creating file C:\Your_Project\docs\index.rst.
Creating file C:\Your_Project\docs\Makefile.
Creating file C:\Your_Project\docs\make.bat.
Finished: An initial directory structure has been created.
我怎么知道该选哪一个
我看到的普遍选择是选择将源代码与构建代码分开。将文件分开可以使更大的项目更有条理。唯一的缺点是你会有更多的目录,这在一开始可能看起来很混乱,但从长远来看,增加的分离往往是值得的