django 运行报错view must be a callable or a list/tuple in the case of include()

时间:2021-08-20 17:02:13

  django 运行报错view must be a callable or a list/tuple in the case of include()

  网上找了相关资料发现

  django 1.10之后不在支持URL用字符串表示了 
http://*.com/questions/38744285/django-urls-error-view-must-be-a-callable-or-a-list-tuple-in-the-case-of-includ

  那我们换种写法,

  from myindex.bb import hi
  import myindex

  urlpatterns = [
  url(r'^admin/', admin.site.urls),
  url(r'^index', hi),
  ]

  测试通过,OK