我已经使用Sphinx为Django项目创建了文档,并在执行make html
命令后将html
文件夹的内容复制到docs/
> 我的存储库的文件夹并将其推送到 Github。之后,我将此 docs/
目录设置为 Github Pages
,现在它正在加载文档,但 css
不起作用,它只是一个文档文本与任何造型。
这是我的 Sphinx 的 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 = '.'
这是 GitHub 页面中文档页面的链接:https://arycloud.github.io/Tagging-Project-for-Machine-Learning-Natural-Language-Processing/
可能出了什么问题?
最佳答案
我使用 sphinx/githubpages 来记录我的一个 Python 项目。我找到了这个blog post很有帮助。这是我的工作示例 docs directory .
在 docs 目录中添加 .nojekyll 文件将解决该问题。这告诉 github 页面不要通过 jekyll 发布文件。这样,您就不需要更改任何目录名称,并且它应该使用“_”前缀。
关于Python Sphinx css 无法在 github 页面上运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59486442/