/ admin /'set'对象的TypeError是不可逆的,并且要逆转的arguments()必须是一个序列 [英] TypeError at /admin/ 'set' object is not reversible and argument( ) to reverse must be a sequence

查看:126
本文介绍了/ admin /'set'对象的TypeError是不可逆的,并且要逆转的arguments()必须是一个序列的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的应用程序运行正常,但是当我尝试使用管理URL时,发生了此错误。我可以访问网站上除管理页面以外的所有页面。
我的项目是 mini
mini.urls.py

My app was working perfectly but when I tried the admin url, this error occurred.I can access every page of the website except for the admin page. My project is mini mini.urls.py

from django.conf.urls import url,include
from django.contrib import admin

urlpatterns = [
     url(r'^admin/', admin.site.urls),
     url(r'^', include('main.urls')),
     url(r'^', include('signup.urls',namespace='signup')),
]

来自django.conf.urls的main.urls.py

 from django.conf.urls import url,include
 from . import views

 urlpatterns = [
      url(r'^$', views.index,name='index'),
 ]

signup.urls.py

 from django.conf.urls import url,include
 from . import views

 urlpatterns = {
    url(r'^signup/$', views.register, name='register'),
    url(r'^login/$', views.login_user, name='login'),
    url(r'^userpage/$', views.user_page, name='userpage'),
    url(r'^upload/$', views.upload_file, name='upload'),
    url(r'^logout/$', views.logout_user, name='logout'),
    url(r'^(?P<uuid>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]
                                {12})/$', views.doc_detail, name='detail'),
    url(r'^(?P<uuid>[a-f0-9]{8}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]{4}-[a-f0-9]
                                {12})/decrypt/$', views.doc_decrypt, 
                                            name='docdecrypt'),
     }

我在/ admin /

The error I ran into at /admin/

     TypeError at /admin/
     'set' object is not reversible
     Request Method:    GET
     Request URL:   http://127.0.0.1:8000/admin/
     Django Version:    1.10.5
     Exception Type:    TypeError
     Exception Value:   
     'set' object is not reversible
     Exception Location:    
     C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\site-
     packages\django\urls\resolvers.py in _populate, line 196
     Python Executable: 
     C:\Users\user\AppData\Local\Programs\Python\Python36-32\python.exe
     Python Version:    3.6.0
     Python Path:   
     ['C:\\Users\\user\\Desktop\\django projects\\mini',
     'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36-
     32\\python36.zip',
     'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36-32\\DLLs',
     'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36-32\\lib',
     'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36-32',
     'C:\\Users\\user\\AppData\\Local\\Programs\\Python\\Python36-
     32\\lib\\site-packages']

我尝试在另一台PC上运行webapp,因此遇到了出现以下错误:

I tried running my webapp in another pc so I ran into the following error:

     TypeError at /admin/
     argument to reversed() must be a sequence
     Request Method:    GET
     Request URL:   http://127.0.0.1:8000/admin/
     Django Version:    1.10.5
     Exception Type:    TypeError
     Exception Value:   
     argument to reversed() must be a sequence
     Exception Location:    C:\Python27\lib\site-
     packages\django\urls\resolvers.py in _populate, line 196
     Python Executable: C:\Python27\python.exe
     Python Version:    2.7.12
     Python Path:   
     ['C:\\Users\\Admin\\Desktop\\mini',
     'C:\\Python27\\lib\\site-packages\\steganography-0.1.1-py2.7.egg',
     'C:\\Python27\\lib\\site-packages\\pillow-4.0.0-py2.7-win32.egg',
     'C:\\Python27\\lib\\site-packages\\olefile-0.44-py2.7.egg',
     'C:\\WINDOWS\\SYSTEM32\\python27.zip',
     'C:\\Python27\\DLLs',
     'C:\\Python27\\lib',
     'C:\\Python27\\lib\\plat-win',
     'C:\\Python27\\lib\\lib-tk',
     'C:\\Python27',
     'C:\\Python27\\lib\\site-packages']


推荐答案

将signup.urls.py中的括号从这些{}更改为[],这将起作用

in signup.urls.py change the brackets from these { } to [ ] these this will work

这篇关于/ admin /'set'对象的TypeError是不可逆的,并且要逆转的arguments()必须是一个序列的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆