Python NameError: name 'include' is not defined [closed]
添加下面代码后:
urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'',include('learning_blogs.urls', namespace = 'learning_blogs')), ]
有时候运行会出现如下错误:
Python NameError: name 'include' is not defined [closed] |
可能是漏了添加模块,加入以下语句就好了:
from django.conf.urls import include