django by example 第四章 dashboard处html无法渲染问题

时间:2023-03-09 00:52:50
django by example 第四章 dashboard处html无法渲染问题

描述:

实现django by example 代码时,第四章 dashboard处html无法渲染问题。

此时报错,NoReverseMatch at /account/login/, Error during template rendering, Reverse for '*****' not found. '****' is not a valid view function or pattern name. 此时的****为任何需要render的网址。

BUG原因:

项目urls的admin配置未修改,views无法渲染到templates上。

代码:

from django.conf.urls import include, url
from django.contrib import admin urlpatterns = [
#####bug教训#####
#########默认如 url(r'^admin/', admin.site.urls), 如果不改成下面,将会渲染出错#####
url(r'^admin/', include(admin.site.urls)),
url(r'^account/',include('account.urls')),
]