Python Sphinx css 在 github 页面上不起作用

Abd*_*man 7 python django python-sphinx github-pages

我已经使用 Sphinx 为 Django 项目创建了文档,并html在执行make html命令后将文件夹的内容复制到docs/我的 repo 文件夹中并将其推送到 Github。之后,我将此docs/目录设置为Github Pages,现在它正在加载文档,但css不起作用,它只是带有任何样式的文档文本。

这是我的狮身人面像config.py

import os
import sys
import django
sys.path.insert(0, os.path.abspath('..'))
os.environ['DJANGO_SETTINGS_MODULE'] = 'PROJECT_NAME.settings'
django.setup()

templates_path = ['_templates']
exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store']
html_theme = 'bizstyle'
html_static_path = ['_static']
BUILDDIR = '.'
Run Code Online (Sandbox Code Playgroud)

这是来自 GitHub 页面的文档页面的链接:https : //arycloud.github.io/Tagging-Project-for-Machine-Learning-Natural-Language-Processing/

有什么问题?

小智 9

我使用 sphinx/githubpages 来记录我的一个 python 项目。我发现这篇博文很有帮助。这是我的工作文档目录的示例。

在 docs 目录中添加一个 .nojekyll 文件将解决这个问题。这告诉 github pages 不要通过 jekyll 发布文件。有了这个,您不需要更改任何目录名称,它应该使用“_”前缀。


m8m*_*ble 6

长话短说

.nojekyll文件添加到存储库的顶级目录()。

之前的答案相比,该.nojekyll文件必须位于顶层 - 即使您从 提供页面docs/

背景:

Github 页面默认使用jekyll 。当 jekyll 生成站点时,名称以下划线开头的文件不会包含在目标中(source、bottom)。这就是为什么只要您缺少.nojekyll(禁用 jekyll 处理),github 页面就不会为它们提供服务。


小智 0

我也在做同样的事情;问题在于文件夹名称中的下划线。下划线表示忽略该文件夹

我曾经sed修改过。