With Python 2.7.x + Django 1.9:
I create a new super-simple Django skeleton project with django-admin startproject simple
As a sanity check, I create a views.py file with a simple view that outputs a "hello world" type test message and a url route to that view. I can run this with python manage.py runserver and it works fine.
I create a models.py file with a single super simple Django ORM model class. FYI, my goal is to use existing tables and schema, so I don't want the ORM to generate new tables.
class SuperSimpleModel(models.Model):
some_value = models.CharField(blank=True, null=True)
class Meta:
managed = False
db_table = 'model_test_table'
Merely adding import models to my views.py code causes the following error to happen on server startup with python manage.py runserver:
"RuntimeError: Model class simple.models.SuperSimpleModel doesn't declare an explicit app_label and either isn't in an application in INSTALLED_APPS or else was imported before its application was loaded."
I presume that my application isn't initializing correctly? I have boiled this problem down to the above simple set of reproducible steps. I haven't changed anything in settings.py in the above steps. Normally, I would need to configure the database, but I can reproduce the error without even doing that.