gpt4 book ai didi

python - 狮身人面像 : How set the right path for html_static_path in config. py?

转载 作者:行者123 更新时间:2023-12-02 16:00:53 24 4
gpt4 key购买 nike

我是初学者所以也许这个问题听起来很愚蠢但无论如何:

我正在使用 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"]

关于python - 狮身人面像 : How set the right path for html_static_path in config. py?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70739677/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com