TypeError at /admin/ 'set' object is not reversible

匿名 (未验证) 提交于 2019-12-03 02:43:01

问题:

Environment:

Request Method: GET Request URL: http://127.0.0.1:8000/admin/

Django Version: 1.10.6 Python Version: 3.6.0 Installed Applications: ['music.apps.MusicConfig', 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.messages', 'django.contrib.staticfiles'] 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\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\core\handlers\exception.py" in inner 42. response = get_response(request)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\core\handlers\base.py" in _legacy_get_response 249. response = self._get_response(request)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\core\handlers\base.py" in _get_response 187. response = self.process_exception_by_middleware(e, request)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\core\handlers\base.py" in _get_response 185. response = wrapped_callback(request, *callback_args, **callback_kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\contrib\admin\sites.py" in wrapper 229. return self.admin_view(view, cacheable)(*args, **kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\utils\decorators.py" in _wrapped_view 149. response = view_func(request, *args, **kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\views\decorators\cache.py" in _wrapped_view_func 57. response = view_func(request, *args, **kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\contrib\admin\sites.py" in inner 211. return view(request, *args, **kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\views\decorators\cache.py" in _wrapped_view_func 57. response = view_func(request, *args, **kwargs)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\contrib\admin\sites.py" in index 468. app_list = self.get_app_list(request)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\contrib\admin\sites.py" in get_app_list 451. app_dict = self._build_app_dict(request)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\contrib\admin\sites.py" in _build_app_dict 418. model_dict['admin_url'] = reverse('admin:%s_%s_changelist' % info, current_app=self.name)

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\urls\base.py" in reverse 60. app_list = resolver.app_dict[ns]

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\urls\resolvers.py" in app_dict 256. self._populate()

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\urls\resolvers.py" in _populate 209. for name in pattern.reverse_dict:

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\urls\resolvers.py" in reverse_dict 242. self._populate()

File "C:\Users\Dell Laptop\AppData\Local\Programs\Python\Python36-32\lib\site-packages\django-1.10.6-py3.6.egg\django\urls\resolvers.py" in _populate 196. for pattern in reversed(self.url_patterns):

Exception Type: TypeError at /admin/ Exception Value: 'set' object is not reversible

回答1:

in your urls change {} brackets to [] these



易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!