有人可以解释我,我做错了吗?我正在尝试在Django 1.2中启用管理面板。但是链接http://mysite.com/admin引发了404错误,链接http://mysite.com引发了这样的错误:
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 Welcome页面。 仍然无法在谷歌找到解决方案...
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)
)
答案 0 :(得分: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)),
)