python 2.7 - Upgrading to django 1.9 AppRegistryNotReady: Apps aren't loaded yet -


i'm migrating project 1.9 version, , when try execute gives me that:

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 324, in execute     django.setup()   file "/usr/local/lib/python2.7/dist-packages/django/__init__.py", line 18, in setup     apps.populate(settings.installed_apps)   file "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 85, in populate     app_config = appconfig.create(entry)   file "/usr/local/lib/python2.7/dist-packages/django/apps/config.py", line 90, in create     module = import_module(entry)   file "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module     __import__(name)   file "/home/prueba/djcode/spid/preventivos/__init__.py", line 6, in <module>     django.contrib.auth.models import user   file "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/models.py", line 4, in <module>     django.contrib.auth.base_user import abstractbaseuser, baseusermanager   file "/usr/local/lib/python2.7/dist-packages/django/contrib/auth/base_user.py", line 49, in <module>     class abstractbaseuser(models.model):   file "/usr/local/lib/python2.7/dist-packages/django/db/models/base.py", line 94, in __new__     app_config = apps.get_containing_app_config(module)   file "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 239, in get_containing_app_config     self.check_apps_ready()   file "/usr/local/lib/python2.7/dist-packages/django/apps/registry.py", line 124, in check_apps_ready     raise appregistrynotready("apps aren't loaded yet.") django.core.exceptions.appregistrynotready: apps aren't loaded yet. 

things have changed since django < 1.9. had same problem while upgrading django 1.6 1.9. helped me out:

it no longer possible have multiple installed applications same label. in previous versions of django, didn’t work correctly, didn’t crash outright either.

if have 2 apps same label, should create appconfig 1 of them , override label there. should adjust code wherever references application or models old label.

it isn’t possible import same model twice through different paths more. of django 1.6, may happen if you’re manually putting directory , subdirectory on pythonpath. refer section on new project layout in 1.4 release notes migration instructions.

you should make sure that:

  • all models defined in applications listed in installed_apps or have explicit app_label.
  • models aren’t imported side-effect of loading application. specifically, shouldn’t import models in root module of application nor in module define configuration class. django enforce these requirements of version 1.9, after deprecation period.

source: http://django.readthedocs.io/en/latest/releases/1.7.html#standalone-scripts


Comments

Popular posts from this blog

neo4j - finding mutual friends in a cypher statement starting with three or more persons -

php - How to remove letter in front of the word laravel -

minify - Minimizing css files -