以项目的应用名称为novel,views包含模块index()为例!
将urls.py中的文件更改后报错:
TypeError: view must be a callable or a list/tuple in the case of include()
若报这个错误,则加上include():
将
url(r’^admin/’,admin.site.urls),
url(r’^$’,’novel.views.index’),
改成
url(r’^admin/’,include(admin.site.urls)),
url(r’^$’,include(‘novel.views.index’)),
再次运行,还是报错:
ImportError:No module names **
无法解决,则删除include(),并导入novel.views
from novel import views
更改成:url(r’^admin/’,admin.site.urls),
url(r’^$’,views.index),
再次运行python manage.py runserver