首页 > 代码库 > django 运行报错view must be a callable or a list/tuple in the case of include()

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

  技术分享

  网上找了相关资料发现

  django 1.10之后不在支持URL用字符串表示了 
http://stackoverflow.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

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