'WARNING: autodoc: failed to import module 'upload_data_to_server' from module 'manual';
I'm trying to document a Django project using Sphinx's autodoc extension. I have two main problems:
- It's documenting excessivelly in some modules (importing documentation that I don't want from django)
- It's not documenting one of the packages at all.
Here is my django tree:
|main_app
| core
| migrations
| static
| templates
| consumers.py
| forms.py
| models.py
| routing.py
| serializers.py
| urls.py
| views.py
| main_app
| asgi.py
| settings.py
| urls.py
| wsgi.py
| manual
| upload_data_to_server.py
| manage.py
| docs
| _build
| _static
| _templates
| conf.py
| index.rst
| make.bat
| Makefile
The docs file is the one I created to host the files created by sphinx-quickstart
. Then, I changed the conf.py
file adding this lines:
import os
import sys
import django
sys.path.insert(0, os.path.abspath('..'))
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "main_app.settings")
django.setup()
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon']
And I changed index.rst
adding modules
:
Welcome to yourProject's documentation!
====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
I executed sphinx-apidoc -o . ..
and ./make html
. I get something similar to what I want, but as I said before, I get too many comments for django files, and no comments at all for the manual
package.
I'm using this manual package for things outside of django, like uploading some data from some excel to a database on a server. So it does not follow django settings. But how can I specify this to sphinx? I get this error when ./make html
:
WARNING: autodoc: failed to import module 'upload_data_to_server' from module 'manual';
Do I need to add some new path into conf.py
?
In the other hand, how can I 'clean' or edit the comments created by autodoc manually?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|