警告:autodoc:无法导入模块' upload_data_to_server'来自模块'手册';
我正在尝试使用Sphinx的AutoDoc扩展名来记录Django项目。我有两个主要问题:
- 它记录了一些模块中的多余问题(我不想从django导入文档),
- 它根本没有记录其中一个软件包。
这是我的django树:
|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
DOCS文件是我创建的文件,该文件是为了托管sphinx-QuickStart
创建的文件。然后,我更改了conf.py
添加此行的文件:
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']
然后我更改了index.rst
添加模块
:
Welcome to yourProject's documentation!
====================================
.. toctree::
:maxdepth: 2
:caption: Contents:
modules
Indices and tables
==================
* :ref:`genindex`
* :ref:`modindex`
* :ref:`search`
我执行了sphinx-- apidoc -o。 ..
和./进行HTML
。我得到的是类似于我想要的东西,但是正如我之前所说的,我对Django文件有太多评论,而对手册
软件包根本没有评论。 我正在将此手册包用于Django之外的内容,例如将某些数据从某些Excel上传到服务器上的数据库。因此,它不会遵循Django设置。但是如何将其指定为狮身人面像?当./做html
:
WARNING: autodoc: failed to import module 'upload_data_to_server' from module 'manual';
我是否需要在conf.py
中添加一些新路径?
另一方面,如何手动“清洁”或编辑由AutoDoc创建的评论?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论