I'm getting the below stacktrace error when I try to runserver or makemigrations:
Traceback (most recent call last):
File "manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 350, in execute_from_command_line
utility.execute()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/__init__.py", line 342, in execute
self.fetch_command(subcommand).run_from_argv(self.argv)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 348, in run_from_argv
self.execute(*args, **cmd_options)
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 398, in execute
self.check()
File "/usr/local/lib/python2.7/dist-packages/django/core/management/base.py", line 426, in check
include_deployment_checks=include_deployment_checks,
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/registry.py", line 75, in run_checks
new_errors = check(app_configs=app_configs)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 10, in check_url_config
return check_resolver(resolver)
File "/usr/local/lib/python2.7/dist-packages/django/core/checks/urls.py", line 19, in check_resolver
for pattern in resolver.url_patterns:
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[
self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns
patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)
File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py", line 33, in __get__
res = instance.__dict__[
self.name] = self.func(instance)
File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module
return import_module(self.urlconf_name)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/ubuntu/workspace/hyp_api/urls.py", line 22, in <module>
url(r'^admin/', admin.site.urls),
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py", line 303, in urls
File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py", line 258, in get_urls
from django.contrib.contenttypes import views as contenttype_views
File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/views.py", line 5, in <module>
from django.contrib.contenttypes.models import ContentType
File "/usr/local/lib/python2.7/dist-packages/django/contrib/contenttypes/models.py", line 159, in <module>
class ContentType(models.Model):
File "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 103, in __new__
"application was loaded. " % (module, name))
RuntimeError: Model class django.contrib.contenttypes.models.ContentType 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've looked at the following S/O and github discussions:
Here are my INSTALLED_APPS and REST_FRAMEWORK variables from my settings.py file:
INSTALLED_APPS = [
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
# Uncomment the next line to enable admin documentation:
# 'django.contrib.admindocs',
'rest_framework',
'hypes_REST',
]
REST_FRAMEWORK = {
'UNAUTHENTICATED_USER': None,
'DEFAULT_AUTHENTICATION_CLASSES' : [],
'DEFAULT_PERMISSION_CLASSES' : [],
}
I was just working on some nested serializers and this error started coming up. My models have app_labels explicitly defined, but since I'm working on the cloud 9 platform I can't go in and explicitly define app_labels for django.contrib.contenttypes.models.ContentType
I'm not sure if this has to do with some other unrelated issue since these installed apps were working just fine 1 hour ago.