I have spent countless hours but this is still stuck. The documentation is so lacking. Using Django 1.10, trying to create Sphinx documentation which has been giving various errors. Finally I am stuck here. I created an example model in my main app kyc_connect
as below.
Models.py
from django.db import models
class example(models.Model):
filed1 = models.DateTimeField(auto_now=True)
# class Meta:
# app_label = 'kyc_connect'
Running make_html
gives the below error.
RuntimeError: Model class kyc_connect.models.example doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
Conf.py import settings
import os
import sys
sys.path.insert(0, os.path.abspath('..'))
from django.conf import settings
settings.configure()
import django
django.setup()
When I include Meta
class presently commented out, this errors goes away.
But if I include a model with ForeignKey
and import from django.contrib.auth.models import User
it gives error RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
INSTALLED_APPS
INSTALLED_APPS = [
'django.contrib.admin',
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'rest_framework_swagger',
'rest_framework',
'rest_framework.authtoken',
'kyc_connect',
'kyc_connect_data_models',
'kyc_rest_services.kyc_connect_accounts',
'kyc_rest_services.kyc_connect_documents',
'kyc_rest_services.kyc_connect_transaction_manager',
'tasks',
'elasticstack',
'corsheaders',
'haystack'
]
ProjectStructure
kyc_connect:
-config
-docs
-kyc_connect
-models.py
.
.
-kyc_connect_data_models
-kyc_core
-kyc_rest_services
-kyc_connect_accounts
-kyc_connect_transaction_manager
.
.
.
.
I already have django.contrib.contentype
there. But django doesn't seem to understand. I don't want to declare meta class. What is going wrong. Any help would be great.