想直接显示图片,加个静态的地址,查了许多网上资料。写进去后报错:TypeError: view must be a callable or a list/tuple in the case of include().

就是下面这段代码

 url(r'^images/(?P<path>.*)$',  serve, {'document_root': os.path.join( STATIC_ROOT , 'images' )}),

django1.10不再支持上面这种写法,正确的写法如下

from django.views.static import serve
url(r'^images/(?P<path>.*)$',  serve, {'document_root': os.path.join( STATIC_ROOT , 'images/' )}),

记下给自己和朋友提个醒。

相关文章:

  • 2022-12-23
  • 2022-12-23
  • 2021-07-15
  • 2021-09-29
  • 2021-07-05
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-05-03
  • 2021-06-10
  • 2022-02-25
  • 2021-07-22
  • 2021-10-18
相关资源
相似解决方案