我收到此错误:
Unhandled exception in thread started by <function check_errors.<locals>.wrapper at 0x7f78dfe090d0>
Traceback (most recent call last):
File "/webapps/onehyr/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/webapps/onehyr/lib/python3.6/site-packages/django/core/management/commands/runserver.py", line 109, in inner_run
autoreload.raise_last_exception()
File "/webapps/onehyr/lib/python3.6/site-packages/django/utils/autoreload.py", line 249, in raise_last_exception
six.reraise(*_exception)
File "/webapps/onehyr/lib/python3.6/site-packages/django/utils/six.py", line 685, in reraise
raise value.with_traceback(tb)
File "/webapps/onehyr/lib/python3.6/site-packages/django/utils/autoreload.py", line 226, in wrapper
fn(*args, **kwargs)
File "/webapps/onehyr/lib/python3.6/site-packages/django/__init__.py", line 18, in setup
apps.populate(settings.INSTALLED_APPS)
File "/webapps/onehyr/lib/python3.6/site-packages/django/apps/registry.py", line 108, in populate
app_config.import_models(all_models)
File "/webapps/onehyr/lib/python3.6/site-packages/django/apps/config.py", line 202, in import_models
self.models_module = import_module(models_module_name)
File "/webapps/onehyr/lib/python3.6/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 994, in _gcd_import
File "<frozen importlib._bootstrap>", line 971, in _find_and_load
File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 678, in exec_module
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "/webapps/onehyr/ladislist/blog/models.py", line 5, in <module>
from django.shortcuts import reverse
ImportError: cannot import name 'reverse'
以下是我在model.py中的导入
from django.contrib.auth.models import User
from django.db import models
from django.shortcuts import reverse
from django.utils import timezone, html
from django.utils.safestring import mark_safe
Django版本是2.0.1
直到我安装了django-grappelli才完成所有工作。现在即使卸载它,我仍然面临同样的问题。就像我的整个django只是乱七八糟。
答案 0 :(得分:1)
我刚刚发现了这个问题。我还通过pip安装了django-tinymce-4,在安装过程中将我的django安装降级到1.9.2。我不得不卸载并重新安装django。
除非你django --version <= 1.9.2