Django模板不存在/

时间:2016-09-27 09:50:21

标签: django url web-applications

所以我在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

0 个答案:

没有答案