2017-01-21 11 views
0

autodoc을 사용하여 html을 만들려고 할 때 오류가 발생합니다. 여기 django 오류가있는 스도그 색인 Autodoc

내 프로젝트 구조입니다 :

projet 
--- app1 
------ models.py 
------ views.py 
--- app2 
--- app3 
docs 
--- modules 
------ models.rst 
--- conf.py 
--- index.rst 
__init__.py 
manage.py 

내 conf.py

import os 
import sys 

sys.path.insert(0, os.path.abspath('..')) 
from django.conf import settings 
settings.configure() 

import django 
django.setup() 

# -- General configuration 

extensions = ['sphinx.ext.autodoc', 
'sphinx.ext.coverage'] 

그리고 내 model.rst

Models 
====== 
.. automodule:: projet.app1.models 
    :members: 
    :undoc-members: 

그리고이 오류 HET :

D:\Agrome\Agrome bitbucket\agrome-backend\docs\modules\models.rst:3: WARNING: autodoc: failed to import module u'agrome.boxes.models'; the following exception was raised: 
    Traceback (most recent call last): 
     File "c:\python27\lib\site-packages\sphinx\ext\autodoc.py", line 547, in import_object 
     __import__(self.modname) 
     File "D:\Agrome\Agrome bitbucket\agrome-backend\agrome\boxes\models.py", line 5, in <module> 
     from django.contrib.auth.models import User 
     File "c:\python27\lib\site-packages\django\contrib\auth\models.py", line 6, in <module> 
     from django.contrib.contenttypes.models import ContentType 
     File "c:\python27\lib\site-packages\django\contrib\contenttypes\models.py", line 161, in <module> 
     class ContentType(models.Model): 
     File "c:\python27\lib\site-packages\django\db\models\base.py", line 102, in __new__ 
     "INSTALLED_APPS." % (module, name) 
RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS. 

automodule :: projet.app1 (whitout .models)을 입력하면 작동하지만 문서는 비어 있습니다.

의견이 있으십니까?

감사

+0

포스트 당신의 D : \ Agrome \ Agrome의 bitbucket \ agrome - 백엔드 \ agrome 상자 \ \ models.py –

답변

0

가/제거 conf.py에 settings.configure()을 주석 시도를 많이