Python Django模拟类型错误
伙计们,我不知道这个错误是怎么回事。代码不是我写的,所以我对它了解不多。非常感谢您的帮助。当需要时,我会用您要求的任何其他信息更新问题。上传到堆栈溢出的代码很难读取,因此回复代码帖子可能需要很长时间Python Django模拟类型错误,python,django,Python,Django,伙计们,我不知道这个错误是怎么回事。代码不是我写的,所以我对它了解不多。非常感谢您的帮助。当需要时,我会用您要求的任何其他信息更新问题。上传到堆栈溢出的代码很难读取,因此回复代码帖子可能需要很长时间 Environment: Request Method: GET Request URL: http://192.168.2.214/accounts/login/?next=/ Django Version: 1.11.6 Python Version: 2.7.12 Installed
Environment:
Request Method: GET
Request URL: http://192.168.2.214/accounts/login/?next=/
Django Version: 1.11.6
Python Version: 2.7.12
Installed Applications:
('django.contrib.auth',
'django.contrib.admin',
'django.contrib.contenttypes',
'django.contrib.sessions',
'tsa.events')
Installed Middleware:
('django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'tsa.settings.ChapterMiddleware',
'django.contrib.messages.middleware.MessageMiddleware')
Traceback:
File "/usr/local/lib/python2.7/dist-
packages/django/core/handlers/exception.py"
in inner
41. response = get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in
_legacy_get_response
249. response = self._get_response(request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in
_get_response
187. response = self.process_exception_by_middleware(e,
request)
File "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
in
_get_response
185. response = wrapped_callback(request, *callback_args,
**callback_kwargs)
File "
/home/serverad/django14_project/my_django15_project/tsa/events/views.py"
in login_view
185. next=request.GET.get('next', '/'),
chapters=Chapter.objects.all(), error_msg=error_msg)
File
"/home/serverad/django14_project/my_django15_project/tsa/events/views.py"
in render_template
71. return HttpResponse(txt, mimetype=kwds.get('mimetype','text/html'))
File "/usr/local/lib/python2.7/dist-packages/django/http/response.py" in
__init__
301. super(HttpResponse, self).__init__(*args, **kwargs)
Exception Type: TypeError at /accounts/login/
Exception Value: __init__() got an unexpected keyword argument 'mimetype'
Django 1.7中删除了
mimetype
参数。改为使用content\u type
return HttpResponse(txt, content_type=kwds.get('mimetype','text/html'))
Django 1.7中删除了
mimetype
参数。改为使用content\u type
return HttpResponse(txt, content_type=kwds.get('mimetype','text/html'))
看起来您正在升级到Django的新版本。发行说明和弃用时间表将有助于解释您必须进行的更改。如果您仍然被卡住,搜索错误消息(例如,
\uuuuu init\uuuuuuu()得到一个意外的关键字参数“mimetype”
)通常会显示您必须进行的更改。由于它是如此古老的代码,您可能会发现在1.8 LTS(目前仍受支持)上使用它比直接跳到1.11更容易。看起来您正在升级到Django的新版本。发行说明和弃用时间表将有助于解释您必须进行的更改。如果您仍然被卡住,搜索错误消息(例如,\uuuuu init\uuuuuuu()得到一个意外的关键字参数“mimetype”
)通常会显示您必须进行的更改。由于它是如此古老的代码,您可能会发现在1.8 LTS(目前仍受支持)上使用它比直接跳到1.11更容易。