1

I'm facing a weird mistake. Here I have a Django project that runs very well locally, I even generated the documentation and everything is going perfectly well. The problem is that when I import the project in https://readthedocs.org/ the compilation fails, I tried almost everything, but always the same problem.

I use Django == 2.2 Python == 3.7.8

My project structure:

- Myproject -- docs -- build -- source - conf.py - index.rst - file.rst - another_file.rst make.bat Makefile requirements.txt -- MyprojectDir -- MyappDir 

My conf.py file inside my source directory look like this:

# Configuration file for the Sphinx documentation builder. # # This file only contains a selection of the most common options. For a full # list see the documentation: # https://www.sphinx-doc.org/en/master/usage/configuration.html # -- Path setup -------------------------------------------------------------- # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. # # import os # import sys # sys.path.insert(0, os.path.abspath('.')) # -- Project information ----------------------------------------------------- import os import sys import django cwd = os.path.dirname(os.path.abspath(__file__)) sys.path.insert(0, os.path.abspath(os.path.join(cwd, '../../'))) os.environ['DJANGO_SETTINGS_MODULE'] = 'vtcvlp.settings' django.setup() from sphinx.ext.autosummary import Autosummary from sphinx.ext.autosummary import get_documenter from docutils.parsers.rst import directives from sphinx.util.inspect import safe_getattr import re class AutoAutoSummary(Autosummary): option_spec = { 'methods': directives.unchanged, 'attributes': directives.unchanged } required_arguments = 1 @staticmethod def get_members(obj, typ, include_public=None): if not include_public: include_public = [] items = [] for name in dir(obj): try: documenter = get_documenter(safe_getattr(obj, name), obj) except AttributeError: continue if documenter.objtype == typ: items.append(name) public = [x for x in items if x in include_public or not x.startswith('_')] return public, items def run(self): clazz = str(self.arguments[0]) try: (module_name, class_name) = clazz.rsplit('.', 1) m = __import__(module_name, globals(), locals(), [class_name]) c = getattr(m, class_name) if 'methods' in self.options: _, methods = self.get_members(c, 'method', ['__init__']) self.content = ["~%s.%s" % (clazz, method) for method in methods if not method.startswith('_')] if 'attributes' in self.options: _, attribs = self.get_members(c, 'attribute') self.content = ["~%s.%s" % (clazz, attrib) for attrib in attribs if not attrib.startswith('_')] finally: return super(AutoAutoSummary, self).run() def setup(app): app.add_directive('autoautosummary', AutoAutoSummary) project = 'vtc-video-link-post' copyright = '2020, MBAMBA FABRICE DAMIEN' author = 'MBAMBA FABRICE DAMIEN' # The full version, including alpha/beta/rc tags release = '1.0' master_doc = 'index' autosummary_generate = True source_suffix = [".rst", ".md"] pygments_style = "sphinx" # -- General configuration --------------------------------------------------- # Add any Sphinx extension module names here, as strings. They can be # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.intersphinx', 'sphinx.ext.todo', 'sphinx.ext.ifconfig', 'sphinx.ext.viewcode', 'sphinx.ext.inheritance_diagram', 'sphinx.ext.autosummary', 'recommonmark', 'sphinx.ext.coverage' 'sphinx.ext.ifconfig', 'sphinx_autodoc_typehints', ] # Add any paths that contain templates here, relative to this directory. templates_path = ['_templates'] # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This pattern also affects html_static_path and html_extra_path. exclude_patterns = [] # -- Options for HTML output ------------------------------------------------- # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # html_theme = 'sphinx_rtd_theme' # Add any paths that contain custom static files (such as style sheets) here, # relative to this directory. They are copied after the builtin static files, # so a file named "default.css" will overwrite the builtin "default.css". html_static_path = ['_static'] 

When i compiling my document in https://readthedocs.org/ I get this error, but it install all requirements files

Running Sphinx v3.2.1 loading translations [en]... done making output directory... done building [mo]: targets for 0 po files that are out of date building [readthedocs]: targets for 5 source files that are out of date updating environment: [new config] 5 added, 0 changed, 0 removed reading sources... [ 20%] source/index reading sources... [ 40%] source/intro reading sources... [ 60%] source/launch reading sources... [ 80%] source/usage reading sources... [100%] source/vtcvlp /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:7: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.models.CustomUser :members: :undoc-members: :show-inheritance: .. rubric:: Methods .. autoautosummary:: vtcuser.models.CustomUser :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.models.CustomUser :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:24: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.models.VideoLink :members: :undoc-members: :show-inheritance: .. rubric:: Methods .. autoautosummary:: vtcuser.models.VideoLink :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.models.VideoLink :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:41: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.api.CustomUserViewSet :members: :undoc-members: .. rubric:: Methods .. autoautosummary:: vtcuser.api.CustomUserViewSet :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.api.CustomUserViewSet :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:57: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.api.VideoLinkViewSet :members: :undoc-members: :show-inheritance: .. rubric:: Methods .. autoautosummary:: vtcuser.api.VideoLinkViewSet :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.api.VideoLinkViewSet :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:74: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.serializers.CustomUserSerializer :members: :undoc-members: :show-inheritance: .. rubric:: Methods .. autoautosummary:: vtcuser.serializers.CustomUserSerializer :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.serializers.CustomUserSerializer :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:91: WARNING: Unknown directive type "autoclass". .. autoclass:: vtcuser.serializers.VideoLinkSerializer :members: :undoc-members: :show-inheritance: .. rubric:: Methods .. autoautosummary:: vtcuser.serializers.VideoLinkSerializer :methods: .. rubric:: Attributes .. autoautosummary:: vtcuser.serializers.VideoLinkSerializer :attributes: /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/source/vtcvlp.rst:109: WARNING: Unknown directive type "automodule". .. automodule:: vtcuser.views :members: :undoc-members: :show-inheritance: Traceback (most recent call last): File "/home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/envs/latest/lib/python3.7/site-packages/sphinx/cmd/build.py", line 280, in build_main app.build(args.force_all, filenames) File "/home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/envs/latest/lib/python3.7/site-packages/sphinx/application.py", line 348, in build self.builder.build_update() File "/home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 299, in build_update len(to_build)) File "/home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 311, in build updated_docnames = set(self.read()) File "/home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/envs/latest/lib/python3.7/site-packages/sphinx/builders/__init__.py", line 422, in read self.env.doc2path(self.config.master_doc)) sphinx.errors.SphinxError: master file /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/index.rst not found Sphinx error: master file /home/docs/checkouts/readthedocs.org/user_builds/vtc-vlp/checkouts/latest/docs/index.rst not found 

Locally All work very well that's look at this:

Running Sphinx v3.2.1 making output directory... done [autosummary] generating autosummary for: index.rst, intro.rst, launch.rst, usage.rst, vtcvlp.rst building [mo]: targets for 0 po files that are out of date building [html]: targets for 5 source files that are out of date updating environment: [new config] 5 added, 0 changed, 0 removed reading sources... [100%] vtcvlp looking for now-outdated files... none found pickling environment... done checking consistency... done preparing documents... done writing output... [100%] vtcvlp generating indices... genindex py-modindexdone highlighting module code... [100%] vtcuser.views writing additional pages... searchdone copying images... [100%] capture4.png copying static files... ... done copying extra files... done dumping search index in English (code: en)... done dumping object inventory... done build succeeded. The HTML pages are in build\html. 

Readthedoc errors log details: ---->>>> The build log details

Where could I have made a mistake?

4
  • You don't provide enough information for anyone to help you. Check the build log on RTD for details, or share a link to it. Commented Sep 14, 2020 at 12:45
  • Steve Piercy i have add it. Please i wait any positive comment. Commented Sep 15, 2020 at 13:25
  • Did you find a solution? I'm smashing my head on exactly the same problem.... Commented Aug 5, 2021 at 8:05
  • @Davide_sd, Yes i have finally found solution Commented Aug 15, 2021 at 9:00

1 Answer 1

4

For those who had the same issue, I had exacatly the same issue when RTD built from my github reop. I finally found that the reason was the wrong configuration of conf.py path in .readthedocs.yaml.

# File: .readthedocs.yaml version: 2 # Build from the docs/ directory with Sphinx sphinx: configuration: docs/conf.py ... 

Actually, my conf.py located in docs/source, when I changed the last line as shown below, it worked as expected.

 configuration: docs/source/conf.py 
Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.