Django allauth和ImportError

时间:2016-02-18 21:12:00

标签: django django-allauth

我刚刚完成了这个介绍,当我正在尝试

./manage.py migrate

我收到此错误:

Traceback (most recent call last):
File "./manage.py", line 10, in <module>
execute_from_command_line(sys.argv)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 353, in execute_from_command_line
utility.execute()
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/core/management/__init__.py", line 327, in execute
django.setup()
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/apps/registry.py", line 85, in populate
app_config = AppConfig.create(entry)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/django/apps/config.py", line 116, in create
mod = import_module(mod_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
File "/home/me0o/work/v_venv/local/lib/python2.7/site-packages/allauth/socialaccount/providers/__init__.py", line 2, in <module>
from django.utils import importlib
ImportError: cannot import name importlib

我有Django 1.9.2 我有最新版本的importlib 有什么想法吗?

2 个答案:

答案 0 :(得分:2)

django.utils.importlib在Django 1.7中被弃用,在Django 1.9中删除。

由于allauth中发生错误,您应该将django-allauth升级到最新版本。根据{{​​3}},版本0.24.0应该支持Django 1.9。

答案 1 :(得分:0)

改变你的

from django.utils import importlib

为:

from importlib import import_module