gpt4 book ai didi

python - Django: ImportError: 没有名为 doc 的模块

转载 作者:太空宇宙 更新时间:2023-11-04 08:31:54 31 4
gpt4 key购买 nike

这是回溯

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 freeze:

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 但没有人在谈论这样的错误。!

最佳答案

一些弃用的元素 have been removed [Django-doc] :

  • django.middleware.doc.XViewMiddleware will be removed. Use django.contrib.admindocs.middleware.XViewMiddleware instead.

所以在您的MIDDLEWARE_CLASSES中,您应该将其替换为:

# settings.py

MIDDLEWARE_CLASSES = (
'django.middleware.common.CommonMiddleware',
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
<b>'django.contrib.admindocs.middleware.XViewMiddleware'</b>,
'django.contrib.flatpages.middleware.FlatpageFallbackMiddleware',
)

在以后的版本中,MIDDLEWARE_CLASSES 被重命名为 MIDDLEWARE。如果你升级 Django 版本,我建议你检查 deprecation page并做出相应的改变。通常一个项目在被删除之前被标记为弃用两个版本。所以它在 中被标记为已弃用.

关于python - Django: ImportError: 没有名为 doc 的模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52256489/

31 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com