Opened 7 years ago

Last modified 7 years ago

#29169 closed Uncategorized

Upgrade django 1.8 to 1.9 — at Initial Version

Reported by: Olivetree Owned by: nobody
Component: contrib.contenttypes Version: 1.9
Severity: Normal Keywords: upgrade, error, contenttypes, app_label, INSTALLED_APPS
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

I am upgrading from django 1.8.4 to 1.9.13. I installed django 1.9.3 and added to my settings

import django
django.setup ()

My application no longer works, it displays the following error:

Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f9c9655b158>
Traceback (most recent call last):

File "/usr/local/lib/python3.4/dist-packages/django/utils/autoreload.py", line 226, in wrapper

fn(*args, kwargs)

File "/usr/local/lib/python3.4/dist-packages/django/core/management/commands/runserver.py", line 116, in inner_run

self.check(display_num_errors=True)

File "/usr/local/lib/python3.4/dist-packages/django/core/management/base.py", line 426, in check

include_deployment_checks=include_deployment_checks,

File "/usr/local/lib/python3.4/dist-packages/django/core/checks/registry.py", line 75, in run_checks

new_errors = check(app_configs=app_configs)

File "/usr/local/lib/python3.4/dist-packages/django/core/checks/urls.py", line 13, in check_url_config

return check_resolver(resolver)

File "/usr/local/lib/python3.4/dist-packages/django/core/checks/urls.py", line 23, in check_resolver

for pattern in resolver.url_patterns:

File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py", line 33, in get

res = instance.dict[self.name] = self.func(instance)

File "/usr/local/lib/python3.4/dist-packages/django/core/urlresolvers.py", line 417, in url_patterns

patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module)

File "/usr/local/lib/python3.4/dist-packages/django/utils/functional.py", line 33, in get

res = instance.dict[self.name] = self.func(instance)

File "/usr/local/lib/python3.4/dist-packages/django/core/urlresolvers.py", line 410, in urlconf_module

return import_module(self.urlconf_name)

File "/usr/lib/python3.4/importlib/init.py", line 109, in import_module

return _bootstrap._gcd_import(name[level:], package, level)

File "<frozen importlib._bootstrap>", line 2254, in _gcd_import
File "<frozen importlib._bootstrap>", line 2237, in _find_and_load
File "<frozen importlib._bootstrap>", line 2226, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 1200, in _load_unlocked
File "<frozen importlib._bootstrap>", line 1129, in _exec
File "<frozen importlib._bootstrap>", line 1471, in exec_module
File "<frozen importlib._bootstrap>", line 321, in _call_with_frames_removed
File "/home/eva/work/test_upgrade_django_to_1_11/be/centroproduto/urls.py", line 7, in <module>

from django.contrib.auth.views import login, logout

File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/views.py", line 11, in <module>

from django.contrib.auth.forms import (

File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/forms.py", line 10, in <module>

from django.contrib.auth.models import User

File "/usr/local/lib/python3.4/dist-packages/django/contrib/auth/models.py", line 6, in <module>

from django.contrib.contenttypes.models import ContentType

File "/usr/local/lib/python3.4/dist-packages/django/contrib/contenttypes/models.py", line 161, in <module>

class ContentType(models.Model):

File "/usr/local/lib/python3.4/dist-packages/django/db/models/base.py", line 102, in new

"INSTALLED_APPS." % (module, name)

RuntimeError: Model class django.contrib.contenttypes.models.ContentType doesn't declare an explicit app_label and isn't in an application in INSTALLED_APPS.


I can not even run migrations ...
In my settings I have:

(...)

import django
django.setup()

(...)

INSTALLED_APPS = (

'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.contrib.admin',
'myapp',
#'debug_toolbar',
'django_extensions',
'corsheaders',
'watson',
'raven.contrib.django.raven_compat',
#'django.contrib.admindocs',
'django_mailbox',
'django.contrib.postgres',

)

(...)


I'm using python3.4 and postgresql9.3

Change History (0)

Note: See TracTickets for help on using tickets.
Back to Top