为了账号安全,请及时绑定邮箱和手机立即绑定

Django 2.1.3 错误:__init__() 采用 1 个位置参数,但给出了 2 个

Django 2.1.3 错误:__init__() 采用 1 个位置参数,但给出了 2 个

温温酱 2021-09-02 20:12:05
我正在尝试使用 Django 2.1.3 和 python 3.7.1 开发一个网站,当我转到主页时,出现此错误:TypeError at / __init__() takes 1 positional argument but 2 were given以下是我编写的代码的一些细节:追溯    Environment:    Request Method: GET    Request URL: http://127.0.0.1:8000/        Django Version: 2.1.3    Python Version: 3.7.1    Installed Applications:    ['django.contrib.admin',     'django.contrib.auth',     'django.contrib.contenttypes',     'django.contrib.sessions',     'django.contrib.messages',     'django.contrib.staticfiles',     'core',     'crispy_forms']    Installed Middleware:    ['django.middleware.security.SecurityMiddleware',     'django.contrib.sessions.middleware.SessionMiddleware',     'django.middleware.common.CommonMiddleware',     'django.middleware.csrf.CsrfViewMiddleware',     'django.contrib.auth.middleware.AuthenticationMiddleware',     'django.contrib.messages.middleware.MessageMiddleware',     'django.middleware.clickjacking.XFrameOptionsMiddleware']                Traceback:        File "C:\Users\andre\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\exception.py" in inner      34.             response = get_response(request)        File "C:\Users\andre\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response      126.                 response = self.process_exception_by_middleware(e, request)        File "C:\Users\andre\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\core\handlers\base.py" in _get_response      124.                 response = wrapped_callback(request, *callback_args, **callback_kwargs)        File "C:\Users\andre\AppData\Local\Programs\Python\Python37-32\lib\site-packages\django\contrib\auth\decorators.py" in _wrapped_view      21.                 return view_func(request, *args, **kwargs)        Exception Type: TypeError at /    Exception Value: __init__() takes 1 positional argument but 2 were given
查看完整描述

2 回答

  • 2 回答
  • 0 关注
  • 357 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号