该项目在 Django 1.3 上运行良好,一旦我更新到 1.4 的这个错误结果:
NoReverseMatch at / Reverse for 'app_list' 带有参数 '()' 和关键字参数 '{'app_label': ''}' 未找到。
网址.py:
from views import home
urlpatterns = patterns('',
(r'^$', home),
(r'^projects/', include('projects.urls')),
(r'^admin/', include(admin.site.urls)),
)
项目网址:
from django.conf.urls.defaults import *
from views import *
urlpatterns = patterns('projectcenter.projects.views',
url(r'project/(\d+)/$', project_detail, name = 'project_detail' ),
)
视图.py
from django.http import HttpResponse
from django.template import RequestContext
from django.shortcuts import render_to_response
from projects.models import Project
def home(request):
template = 'index.html'
user = request.user
projects = Project.objects.current()
if projects:
map_center = projects[0].location
else:
map_center = (0, 0)
data = {'user': user,
'projects': projects,
'map_center': map_center ,
}
return render_to_response(template, data,
context_instance=RequestContext(request))