生成运行服务器导入错误。在这里,我甚至不在我的文件中的任何地方使用这种泛型类型。
那怎么会产生这个错误???
C:\Python34\python.exe manage.py runserver
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x0000000004BC8B70>
Traceback (most recent call last):
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\core\management\commands\runserver.py", line 112, in inner_run
autoreload.raise_last_exception()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 248, in raise_last_exception
raise _exception[1]
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\core\management\__init__.py", line 327, in execute
autoreload.check_errors(django.setup)()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\utils\autoreload.py", line 225, in wrapper
fn(*args, **kwargs)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\__init__.py", line 24, in setup
apps.populate(settings.INSTALLED_APPS)
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\apps\registry.py", line 112, in populate
app_config.import_models()
File "C:\Python34\lib\site-packages\django-2.0-py3.4.egg\django\apps\config.py", line 198, in import_models
self.models_module = import_module(models_module_name)
File "C:\Python34\lib\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 "C:\Python34\lib\site-packages\tagging\models.py", line 5, in <module>
from django.contrib.contenttypes import generic
ImportError: cannot import name 'generic'
答案 0 :(得分:1)
您的tagging
库不支持Django 2.0。如果您选中Django's git repo,则会在generic
中看到不再有Django.contrib.contenttypes
个模块。它在Django 1.9中删除了。降级到Django 1.8以使您的库工作,或者我建议使用不同的标记库,最好是一个足以维护至少支持Django 1.11的标记库。
答案 1 :(得分:0)
我已经解决了这个错误。
在settings.py文件中,有INSTALLED_APPS。我删除了&#39;标记&#39; 从那解决我所有的错误。
希望这会有所帮助。