为什么我在添加到urls.py后收到NameError:Not Defined?

时间:2014-10-03 02:49:50

标签: django-urls

我收到此错误:

NameError at /storefront/
name 'storefront' is not defined

My Urls.Py看起来像这样:

from django.conf import settings
from django.conf.urls import patterns, include, url
from django.conf.urls.static import static
from django.views.generic import TemplateView
from accounts.views import home
from django.contrib import admin   

urlpatterns = patterns('',
url(r"^$", home),
url(r"^storefront/", storefront, name="storefront")

My Views.Py看起来像这样:

def storefront(request):
    latest_entries = Entry.objects.filter()
    context = {'latest_entries': latest_entries}
    return render(request, 'storefront.html', context)

网址或视图中的错误是什么?

0 个答案:

没有答案