2013-06-11 143 views
2

有人可以解释我,请问我做错了什么?我试图在Django 1.2中启用管理面板。但链接http://mysite.com/admin引发404错误,并且链接http://mysite.com提出了这样的错误:Django管理面板不起作用

TypeError at/

list objects are unhashable 

Request Method:  GET 
Request URL: http://mysite/index.wsgi/ 
Django Version:  1.2.4 
Exception Type:  TypeError 
Exception Value:  

list objects are unhashable 

Exception Location:  /usr/local/lib/python2.5/re.py in _compile, line 230 
Python Executable: /usr/local/bin/python 
Python Version:  2.5.5 
Python Path: ['/usr/local.20100210/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages/setuptools-0.6c11-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Genshi-0.6-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Babel-0.9.5-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Pygments-1.4-py2.5.egg', '/usr/local/lib/python2.5/site-packages/pytz-2010o-py2.5.egg', '/usr/local/lib/python2.5/site-packages/Trac-0.12.1-py2.5.egg', '/usr/local/lib/python2.5/site-packages/IniAdmin-0.2-py2.5.egg', '/usr/local/lib/python2.5/site-packages/TracAccountManager-0.2.1dev-py2.5.egg', '/usr/local/lib/python2.5/site-packages/MySQL_python-1.2.3-py2.5-freebsd-8.2-RELEASE-amd64.egg', '/usr/local/lib/python25.zip', '/usr/local/lib/python2.5', '/usr/local/lib/python2.5/plat-freebsd8', '/usr/local/lib/python2.5/lib-tk', '/usr/local/lib/python2.5/lib-dynload', '/usr/local/lib/python2.5/site-packages', '/usr/local/lib/python2.5/site-packages/PIL', '/usr/local/lib/python2.5/site-packages', '/home/casf58/www/site2/cgi-bin/'] 
Server time: Tue, 11 Jun 2013 20:52:41 +0400 

这是空的测试项目,该项目工作的本地计算机上的罚款。但它不能在托管。当然,我在urls.py和setiings.py中取消了所有必要的注释并多次检查。如果我回复他们,则会显示“Django欢迎”页面。 仍然无法在谷歌找到解决方案...

Python v.2.5。项目使用wsgi_mod。

变化settings.py:

INSTALLED_APPS = (
    'django.contrib.auth', 
    'django.contrib.contenttypes', 
    'django.contrib.sessions', 
    'django.contrib.sites', 
    'django.contrib.messages', 
    'django.contrib.admin', 
    # Uncomment the next line to enable admin documentation: 
    # 'django.contrib.admindocs', 
) 

我的urls.py:

from django.conf.urls.defaults import * 

# Uncomment the next two lines to enable the admin: 
from django.contrib import admin 
admin.autodiscover() 

urlpatterns = patterns('', 
    # Example: 
    # (r'^mysite/', include('mysite.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    r'^admin/', include(admin.site.urls) 
) 
+1

你能显示你修改的设置吗? – karthikr

+0

我的意思是__show__更改后的设置。 – karthikr

+0

我在上面的帖子中添加了更改。 – user2474331

回答

2

您需要附上网址格局()

(r'^admin/', include(admin.site.urls)), 

试试这个:

urlpatterns = patterns('', 
    # Example: 
    # (r'^mysite/', include('mysite.foo.urls')), 

    # Uncomment the admin/doc line below to enable admin documentation: 
    # (r'^admin/doc/', include('django.contrib.admindocs.urls')), 

    # Uncomment the next line to enable the admin: 
    (r'^admin/', include(admin.site.urls)), 
) 
+0

括号中的模式导致“页面未找到(404)”错误。 – user2474331

+0

很可能还有另一场比赛。这是你的整个urls.py吗? – karthikr

+0

是的。这是一个来自教程的简单项目。 – user2474331