Sphinx:如何在 config.py 中设置 html_static_path 的正确路径?
Sphinx: How set the right path for html_static_path in config.py?
我是初学者所以也许这个问题听起来很愚蠢但是无论如何:
我正在使用 sphinx,我想在 config.py 文件中设置 html_static_path 变量。
默认值是:
html_static_path = ['_static']
我的项目设置是:
docs/
build/
doctrees
html/
_static/
source/
conf.py
sphinx 文档说我需要设置相对于此目录的路径,即来自 conf.py 的 rel 路径。所以我尝试了:
html_static_path = ['..\build\html\source\_static']
并且我尝试设置绝对路径。
但我仍然收到警告:
WARNING: html_static_path entry 'build\html\source\_static' does not exist
也许值得一提:
我的 conf.py 文件的“路径设置”是:
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.setrecursionlimit(1500)
你能帮帮我吗?我真的已经尝试了我能想到的路径的每一种组合。
谢谢!
构建目录是在您构建文档后创建的,这就是您收到该错误的原因。制作文档时,Sphinx 会将静态目录从 html_static_path
定义的源位置复制到构建位置。
创建一个新目录 source/_static
并将所有静态资源放入其中。
将 conf.py
中的值更改为:
html_static_path = ["_static"]
我是初学者所以也许这个问题听起来很愚蠢但是无论如何:
我正在使用 sphinx,我想在 config.py 文件中设置 html_static_path 变量。
默认值是:
html_static_path = ['_static']
我的项目设置是:
docs/
build/
doctrees
html/
_static/
source/
conf.py
sphinx 文档说我需要设置相对于此目录的路径,即来自 conf.py 的 rel 路径。所以我尝试了:
html_static_path = ['..\build\html\source\_static']
并且我尝试设置绝对路径。
但我仍然收到警告:
WARNING: html_static_path entry 'build\html\source\_static' does not exist
也许值得一提:
我的 conf.py 文件的“路径设置”是:
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
sys.setrecursionlimit(1500)
你能帮帮我吗?我真的已经尝试了我能想到的路径的每一种组合。 谢谢!
构建目录是在您构建文档后创建的,这就是您收到该错误的原因。制作文档时,Sphinx 会将静态目录从 html_static_path
定义的源位置复制到构建位置。
创建一个新目录 source/_static
并将所有静态资源放入其中。
将 conf.py
中的值更改为:
html_static_path = ["_static"]