所以我在urls.py文件中有这个
urlpatterns = [
url('^$', IndexView.as_view(), name='index'),
]
我的观点如下:
class IndexView(TemplateView):
template_name = 'index.html'
@method_decorator(ensure_csrf_cookie, name="dispatch")
def dispatch(self, *args, **kwargs):
return super(IndexView, self).dispatch(*args, **kwargs)
但是当我点击链接localhost:8000 /我收到一个错误说: -
raise TemplateDoesNotExist(', '.join(template_name_list), chain=chain)
TemplateDoesNotExist: index.html