从Django 1.7.1升级到1.8.2失败 [英] Upgrading from Django 1.7.1 to 1.8.2 fails

查看:80
本文介绍了从Django 1.7.1升级到1.8.2失败的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的Django 1.7.1应用程序运行良好.但是我想升级到更新的版本1.8.2.我正在 此处 进行操作基本上只是说要在我的VirtualEnvironment内部执行pip install -U Django.

My Django 1.7.1 application runs fine. But I would like to upgrade to the more recent version 1.8.2. I'm following the instructions here which basically just say to do pip install -U Django from within my VirtualEnvironment.

尽管我在那行之后,立即尝试做manage.py,但失败,如下所示.

After I do that line though, I Immediately try to do manage.py and it fails as shown below.

有人可以建议我该怎么做才能解决此问题?下面的错误似乎与MPTT模块有关. (我正在运行MPTT的0.6.1版).升级到新版本的django-mptt也会带来一系列麻烦.

Can someone suggest to me what I should do to fix this? The errors below look like they have something to do with the MPTT module. (I'm running version 0.6.1 of MPTT). Upgrading to a newer version of django-mptt as well comes with its own set of messy headaches.

(myVirtualEnv) $ ./manage.py
myVirtualEnv/src/django-cache-machine-origin/caching/invalidation.py:21: RemovedInDjango19Warning: 'get_cache' is deprecated in favor of 'caches'.
  cache = get_cache('cache_machine')

myVirtualEnv/lib/python2.7/site-packages/mptt/forms.py:7: RemovedInDjango19Warning: The django.forms.util module has been renamed. Use django.forms.utils instead.
  from django.forms.util import ErrorList

Traceback (most recent call last):
  File "./manage.py", line 10, in <module>
    execute_from_command_line(sys.argv)
  File "myVirtualEnv/lib/python2.7/site-packages/django/core/management/__init__.py", line 338, in     execute_from_command_line
    utility.execute()
  File "myVirtualEnv/lib/python2.7/site-packages/django/core/management/__init__.py", line 312, in execute
    django.setup()
  File "myVirtualEnv/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
    apps.populate(settings.INSTALLED_APPS)
  File "myVirtualEnv/lib/python2.7/site-packages/django/apps/registry.py", line 108, in populate
    app_config.import_models(all_models)
  File "myVirtualEnv/lib/python2.7/site-packages/django/apps/config.py", line 198, in import_models
    self.models_module = import_module(models_module_name)
  File "/usr/local/Cellar/python/2.7.8_2/Frameworks/Python.framework/Versions/2.7/lib/python2.7/importlib/__init__.py", line 37, in import_module
    __import__(name)
  File "myProject/myApp1/models.py", line 5, in <module>
    from categories.models import Category
  File "myProject/myApp2/models.py", line 22, in <module>
    class Category(CachingMixin, MPTTModel):
  File "myVirtualEnv/lib/python2.7/site-packages/mptt/models.py", line 244, in __new__
    cls = meta.register(cls)
  File "myVirtualEnv/lib/python2.7/site-packages/mptt/models.py", line 338, in register
    tree_manager.init_from_model(cls)
  File "myVirtualEnv/lib/python2.7/site-packages/mptt/managers.py", line 52, in init_from_model
    [tree_field] = [fld for fld in model._meta.get_fields_with_model() if fld[0].name == self.tree_id_attr]
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 56, in wrapper
    return fn(*args, **kwargs)
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 432, in get_fields_with_model
    return [self._map_model(f) for f in self.get_fields()]
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 740, in get_fields
    return self._get_fields(include_parents=include_parents, include_hidden=include_hidden)
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 802, in _get_fields
    all_fields = self._relation_tree
  File "myVirtualEnv/lib/python2.7/site-packages/django/utils/functional.py", line 60, in __get__
    res = instance.__dict__[self.name] = self.func(instance)
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 709, in _relation_tree
    return self._populate_directed_relation_graph()
  File "myVirtualEnv/lib/python2.7/site-packages/django/db/models/options.py", line 681, in     _populate_directed_relation_graph
    all_models = self.apps.get_models(include_auto_created=True)
  File "myVirtualEnv/lib/python2.7/site-packages/django/utils/lru_cache.py", line 101, in wrapper
    result = user_function(*args, **kwds)
  File "myVirtualEnv/lib/python2.7/site-packages/django/apps/registry.py", line 168, in get_models
    self.check_models_ready()
  File "myVirtualEnv/lib/python2.7/site-packages/django/apps/registry.py", line 131, in check_models_ready
    raise AppRegistryNotReady("Models aren't loaded yet.")
django.core.exceptions.AppRegistryNotReady: Models aren't loaded yet.

推荐答案

我讨厌成为坏消息的承担者,但是您遇到了一些与Django开发有关的最令人毛骨悚然的事情:尝试获取所有内容您对正确版本的依赖关系以相互配合.特定版本的依赖项依赖于特定版本的Django并不少见.

I hate to be the bearer of bad news, but you've run into something that's one of the most hellish bits of developing with Django: trying to get all of your dependencies to the right version to work with each other. It's not uncommon for a specific version of a dependency to be dependent on specific versions of Django.

mptt在0.70版之前不支持Django 1.8(请参阅升级说明: http://django-mptt.github.io/django-mptt/upgrade.html ).因此,如果您要使用Django 1.8,则必须先升级mptt.抱歉.

mptt does not support Django 1.8 until version 0.70 (see upgrade notes: http://django-mptt.github.io/django-mptt/upgrade.html) . So if you want Django 1.8, you're going to have to upgrade mptt first. Sorry.

这篇关于从Django 1.7.1升级到1.8.2失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆