这是回溯
System check identified 1 issue (0 silenced).
September 10, 2018 - 13:01:31
Django version 1.8, using settings 'settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CONTROL-C.
Traceback (most recent call last):
File "/usr/lib/python2.7/wsgiref/handlers.py", line 85, in run
self.result = application(self.environ, self.start_response)
File "/home/basha/UpgradeMloss/venv1.8/local/lib/python2.7/site-packages/django/core/handlers/wsgi.py", line 170, in __call__
self.load_middleware()
File "/home/basha/UpgradeMloss/venv1.8/local/lib/python2.7/site-packages/django/core/handlers/base.py", line 50, in load_middleware
mw_class = import_string(middleware_path)
File "/home/basha/UpgradeMloss/venv1.8/local/lib/python2.7/site-packages/django/utils/module_loading.py", line 26, in import_string
module = import_module(module_path)
File "/usr/lib/python2.7/importlib/__init__.py", line 37, in import_module
__import__(name)
ImportError: No module named doc
这是已安装的库pip冻结:
certifi==2018.8.24
chardet==3.0.4
Django==1.8
django-contrib-comments==1.5
django-markup-deprecated==0.0.3
django-recaptcha2==1.3.0
idna==2.7
Markdown==2.6.11
Pillow==5.2.0
pytz==2018.5
recaptcha-client==1.0.6
requests==2.19.1
urllib3==1.23
这也是INSTALLED_APPS:
INSTALLED_APPS = (
'django.contrib.auth',
'django.contrib.contenttypes',
'django.contrib.sessions',
'django.contrib.sites',
'django.contrib.admin',
'django_comments',
'django.contrib.syndication',
'django.contrib.flatpages',
'django.contrib.humanize',
'software',
'revision',
'registration',
'community',
'forshow',
'user',
'subscriptions2',
'aggregator',
'blog',
'captcha',
'snowpenguin.django.recaptcha2',
'markup_deprecated',
)
我不确切知道问题出在哪里或如何解决。 我一直在搜索此ImportError,但没有谈论这样的错误。!
答案 0 :(得分:5)
在django-1.8中,一些不推荐使用的元素have been removed [Django-doc]:
django.middleware.doc.XViewMiddleware
将被删除。请改用django.contrib.admindocs.middleware.XViewMiddleware
。
因此,在您的MIDDLEWARE_CLASSES
中,应将其替换为:
# settings.py
MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.admindocs.middleware.XViewMiddleware',
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)
在更高版本中,MIDDLEWARE_CLASSES
重命名为MIDDLEWARE
。如果您升级Django版本,建议您检查deprecation page并进行相应的更改。通常,在删除一项之前,将其标记为已弃用两个版本。因此它在django-1.6中被标记为不推荐使用。