6

I am working with Sphinx and I want to set the html_static_path variable in the config.py file. The default was:

html_static_path = ['_static']

My project setup is:

docs/
    build/
         doctrees
         html/
             _static/ 
    source/
          conf.py

The sphinx documentation says that I need to set the path relative to this directory, i.e. relative path from conf.py. Thus, I tried:

html_static_path = ['..\build\html\source\_static']

AND I tried to set the absolute path. But I still get the warning:

WARNING: html_static_path entry 'build\html\source\_static' does not exist

Can you help me? Thank you!

Paul
  • 91
  • 1
  • 7

2 Answers2

10

The build directory is created after you build the docs, which is why you get that error. When you make your docs, Sphinx will copy the static directory from your source location as defined by html_static_path to the build location.

Create a new directory source/_static and place any static assets inside of it.

Change the value in conf.py to this:

html_static_path = ["_static"]
Steve Piercy
  • 13,693
  • 1
  • 44
  • 57
0

For anyone else that might come across this and not have the option to create a source/_static folder. You can also instead specify the path something like this ../../app/static, given that your static folder is located in the app folder, which is 2 directories above where your conf.py file is stored.

KyleDev
  • 11
  • 1
  • 5