Python Sphinx CSS无法在github页面上使用 [英] Python Sphinx css not working on github pages

查看:89
本文介绍了Python Sphinx CSS无法在github页面上使用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I have created documentation for a Django project using Sphinx and copy the content of html folder after executing the make html command into the docs/ folder of my repo and push it to Github. After that I have set this docs/ directory to Github Pages, now it's loading the documentation but the css is not working it's just a docs text with any styling.

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

Here's my Sphinx's 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页面到文档页面的链接:

and here's the link to the docs page from GitHub pages: https://arycloud.github.io/Tagging-Project-for-Machine-Learning-Natural-Language-Processing/

怎么了?

推荐答案

我已经使用sphinx/githubpages记录了我的一个python项目.我发现此博客帖子非常有用.这是我的 docs目录的示例.

I've used sphinx/githubpages to document one of my python projects. I found this blog post very helpful. Here's an example of my working docs directory.

在docs目录中添加.nojekyll文件将解决此问题.这告诉github页面不要通过jekyll发布文件.这样,您将不需要更改任何目录名,并且它应与"_"一起使用.前缀.

Adding a .nojekyll file in the docs directory will fix the issue. This tells github pages not to publish the files through jekyll. With this, you won't need to change any directory names and it should work with "_" prefixes.

这篇关于Python Sphinx CSS无法在github页面上使用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆