请帮忙,我的管理界面以前工作正常,但现在当我检查它时,它给了我:
TypeError at /admin/
Unhashable type: 'dict'
我不知道我做了什么把事情搞砸了。我有admin.autodiscover()
我的 url,我运行了 syncdb,contrib.admin
我的INSTALLED
APPS 中有。
我的网址:url(r'^admin/', include(admin.site.urls)),
编辑 :
> Environment:
>
>
> Request Method: GET Request URL: http://127.0.0.1:8000/admin/
>
> Django Version: 1.4.5 Python Version: 2.7.3 Installed Applications:
> ('django.contrib.auth', 'django.contrib.contenttypes',
> 'django.contrib.sessions', 'django.contrib.sites',
> 'django.contrib.admin', 'django.contrib.comments',
> 'django.contrib.messages', 'django.contrib.staticfiles', 'haystack',
> 'bookmarks') Installed Middleware:
> ('django.middleware.common.CommonMiddleware',
> 'django.contrib.sessions.middleware.SessionMiddleware',
> 'django.middleware.csrf.CsrfViewMiddleware',
> 'django.contrib.auth.middleware.AuthenticationMiddleware',
> 'django.contrib.messages.middleware.MessageMiddleware',
> 'django.middleware.clickjacking.XFrameOptionsMiddleware')
>
>
> Traceback: File
> "/usr/local/lib/python2.7/dist-packages/django/core/handlers/base.py"
> in get_response
> 111. response = callback(request, *callback_args, **callback_kwargs) File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py"
> in wrapper
> 213. return self.admin_view(view, cacheable)(*args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/utils/decorators.py" in
> _wrapped_view
> 91. response = view_func(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/views/decorators/cache.py"
> in _wrapped_view_func
> 89. response = view_func(request, *args, **kwargs) File "/usr/local/lib/python2.7/dist-packages/django/contrib/admin/sites.py"
> in inner
> 192. current_app=self.name): File
> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in reverse
> 447. app_list = resolver.app_dict[ns] File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in app_dict
> 290. self._populate() File "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in _populate
> 265. lookups.appendlist(pattern.callback, (bits, p_pattern, pattern.default_args)) File
> "/usr/local/lib/python2.7/dist-packages/django/core/urlresolvers.py"
> in callback
> 216. self._callback = get_callable(self._callback_str) File "/usr/local/lib/python2.7/dist-packages/django/utils/functional.py" in
> wrapper
> 25. if mem_args in cache:
>
> Exception Type: TypeError at /admin/ Exception Value: unhashable type:
> 'dict'
编辑:urls.py:
import os.path
from django.conf.urls import patterns, url, include
from bookmarks.views import *
from bookmarks.feeds import LatestEntriesFeed
from django.views.static import *
from django.conf import settings
from django.views.generic.simple import direct_to_template
from django.contrib.comments.models import Comment
site_media = os.path.join(
os.path.dirname(__file__), 'site_media'
)
# Uncomment the next two lines to enable the admin:
from django.contrib import admin
admin.autodiscover()
urlpatterns = patterns('',
# Uncomment the admin/doc line below to enable admin documentation:
#url(r'^admin/doc/', include('django.contrib.admindocs.urls')),
# Feeds
(r'^latest/feed/$', LatestEntriesFeed()),
#Admin interface
url(r'^admin/', include(admin.site.urls)),
# Comments
(r'^comments/', direct_to_template,
{'template':'comments/posted.html'}),
#social_auth
url(r'',include('social_auth.urls')),
#email invite friend
(r'^friend/invite/$',friend_invite),
(r'^friend/accept/(\w+)/$', friend_accept),
#Browsing
(r'^$', main_page),
(r'^popular/$', popular_page),
(r'^user/(\w+)/$', user_page),
(r'^tag/([^\s]+)/$', tag_page),
(r'^bookmark/(\d+)/$', bookmark_page),
#Session management
(r'^login/$', 'django.contrib.auth.views.login'),
(r'^logout/$', logout_page),
(r'^media/ (?P<path>.*)', #'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}),
(r'^register/$', register_page),
(r'^register/success/$', direct_to_template,
{ 'template': 'registration/register_success.html' }),
#Account management
(r'^save/$', bookmark_save_page),
(r'^tag/$', tag_cloud_page),
(r'^search/$', search_page),
(r'^vote/$', bookmark_vote_page),
#insights
(r'^insights/$', insights_page),
#media for static files
#(r'^media/(/P<path>.*)$','django.views.static.serve',{'document_root':settings.MEDIA_ROOT}),
# Ajax
(r'^ajax/tag/autocomplete/$', ajax_tag_autocomplete),
#static url
(r'^static/(?P<path>.*)$','django.views.static.serve', {'document_root': 'Home/django_bookmarks/static'})
#(r'^django_bookmarks/', include('django_bookmarks.foo.urls')),
)