1
Could not import photocomp.apps.news.views.news. View does not exist in module photocomp.apps.news.views.

它说我在 /news/ 上没有视图,但它是:

网址.py

url(r'^news/', include('photocomp.apps.news.urls')),

urls.py(用于新闻)

from django.conf.urls import patterns, include, url
from django.conf import settings

urlpatterns = patterns('',
url(r'^submit/$', 'photocomp.apps.news.views.submit'),
url(r'^success/$', 'photocomp.apps.news.views.success'),
url(r'^$', 'photocomp.apps.news.views.news'),    
)

设置.py

INSTALLED_APPS = (
    'photocomp.apps.news',
)

这是我的观点:

def news(request):
    news = News_Entry.objects.all().order_by('-publication')
    return render_to_response('news/news.html', {'news':news},context_instance=RequestContext(request))

什么会导致这个问题?我没有它与应用程序的其余部分。

4

1 回答 1

0

找到了答案。

有一个 @login_required('/login') 装饰器而不是 @login_required(login_url='/login')

于 2012-05-28T20:43:14.417 回答