ViewDoesNotExist at / news / django

时间:2012-05-28 19:45:58

标签: python django django-views django-urls

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

它说我没有/ news /的观点,但现在是:

urls.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'),    
)

settings.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))

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

1 个答案:

答案 0 :(得分:0)

找到答案。

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