As of Python 2.7.x + Django 1.9:
I am creating a new super simple Django skeleton project with django-admin startproject simple
As a health check, I create a views.py file with a simple view that displays a hello world test message and a URL of this kind. I can run this with python manage.py runserver and it works fine.
I am creating a models.py file with one super simple Django ORM model class. FYI, my goal is to use existing tables and schema, so I don't want 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'
Just adding import models to my views.py code leads to the following error when starting the server using python manage.py runserver :
"RuntimeError: model class simple.models.SuperSimpleModel does not declare an explicit app_label label and is not in the application in INSTALLED_APPS or was still imported before the application was loaded."
I assume my application is not initializing correctly? I digested this problem down to the above simple set of reproducible steps. In the steps above, I did not change anything in settings.py . Usually I need to set up a database, but I can reproduce the error without even doing it.
source share