django urls.py更改遇到问题

时间:2021-12-01 21:44:10

Q:TypeError: view must be a callable or a list/tuple in the case of include()

A:django 1.10版本改了写法了。首先要在引入view模块,其次后面URL设置里views.hello不要加引号了。

E:

from django.conf.urls import url

from django.contrib import admin

from blogapp import views

urlpatterns = [

url(r'^admin/', admin.site.urls),

url(r'helloworld',views.hello)

]