I am using django installed via cookiecutter(running inside virtualenv). On top of the file I try to setup django env. like this:
import os
import sys
import django
sys.path.append('/vagrant/my_project/my_project/')
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings.local')
django.setup()
from models import KeyO # This one loads models.py from the same directory.
models.py looks like this:
from django.db import models
from django.conf import settings
from decimal import Decimal
from django.core.validators import MaxValueValidator
from djmoney.models.fields import MoneyField
class KeyO(models.Model):
keyword = models.CharField('Keyword', max_length=1000, unique=True)
...
And here is the error:
RuntimeError: Model class models.KeyO doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.
I didn't modify apps.py and my settings file loads this app at the end. Any ideas?
Note: Using py3.5 and django 1.10 dev
Edit:
local settings: https://gist.github.com/daniel1943/6148f27e157bdb251666 common(main settings): https://gist.github.com/daniel1943/76c46fcfaaa996c9fd66