Django的urls.py加载静态资源图片,TypeError: view must be a callable or a list/tuple in the case of include().

想直接显示图片,加个静态的地址,查了许多网上资料。写进去后报错: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/' )}),

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

Django的urls.py加载静态资源图片,TypeError: view must be a callable or a list/tuple in the case of include().的更多相关文章

  1. django错误笔记——TypeError: view must be a callable or a list/tuple in the case of include().解决办法

    django增加用户认证模块时,总是提醒模块的url.py中 url(r'^login/$', 'django.contrib.auth.views.login', name='login'),出错: ...

  2. Django出现的错误1.TypeError: view must be a callable or a list/tuple in the case of include().1.TypeError: view must be a callable or a list/tuple in the case of include().

    .TypeError: view must be a callable or a list/tuple in the case of include(). 原因: url(r"^upload ...

  3. django 修改urls.py 报错误:TypeError: view must be a callable or a list/tuple in the case of include().

    #coding=utf-8 from django.conf.urls import include,url from django.contrib import admin from blog im ...

  4. django报错解决:view must be a callable or a list/tuple in the case of include().

    django版本:1.11.15 django应用,修改urls.py后,访问报错:TypeError at /view must be a callable or a list/tuple in t ...

  5. Django URLs error: view must be a callable or a list/tuple in the case of include()

    Django 1.10 no longer allows you to specify views as a string (e.g. 'myapp.views.home') in your URL ...

  6. flask模板应用-加载静态文件:添加Favicon,使用CSS框架,使用宏加载静态资源

    加载静态文件 一个Web项目不仅需要HTML模板,还需要许多静态文件,比如CSS.JavaScript文件.图片和声音声.在flask程序中,默认需要将静态文件存储在与主脚本(包含程序实例的脚本)同级 ...

  7. Thymeleaf模板引擎绕过浏览器缓存加载静态资源js,css文件

    浏览器会缓存相同文件名的css样式表或者javascript文件.这给我们调试带来了障碍,好多时候修改的代码不能在浏览器正确显示. 静态常见的加载代码如下: <link rel="st ...

  8. Flask之加载静态资源

    Flask之加载静态资源 1.加载css样式 <link rel="stylesheet" href="{{ url_for('static',filename=' ...

  9. nginx反向代理部署springboot项目报404无法加载静态资源

    问题:nginx反向代理部署springboot项目报404无法加载静态资源(css,js,jpg,png...) springboot默认启动端口为8080,如果需要通过域名(不加端口号)直接访问s ...

随机推荐

  1. Batch入门教程丨第一章:部署与Hello World!(上)

    Batch入门教程 在本教程中,您将了解并学习与Windows Batch有关的知识和编程方法,用以解决在日常生活中所遇到的简单问题,或者利用Windows Batch建立一个最初级的编程思维方式. ...

  2. [Swift]LeetCode843. 猜猜这个单词 | Guess the Word

    This problem is an interactive problem new to the LeetCode platform. We are given a word list of uni ...

  3. Kubernetes系列之理解K8s Service的几种模式

    今天给大家介绍下k8s的service的几种访问模式. 概述 我们知道pod的ip不是固定的,是根据所在宿主机的docker0网卡生成的,每次重启,更新,调度等情况IP都会变,那pod与pod之间需要 ...

  4. idea设置代码颜色主题(同Sublime Text 3的代码颜色一样)

    1.下载主题的网址:http://color-themes.com,主题种类多,总有适合你的主题.在这个网址下载的主题是jar文件,直接导入,如下图file->import  Setting,找 ...

  5. Cassandra与Mongo的事务实现之分布式协议

    摘要 NoSql不同于关系型数据库,是分布式存储,因此想要实现关系型数据库中的事务就不是那么简单了.本文结合Cassandra中的paxos和Mongo的two phase commit来谈谈Nosq ...

  6. WebSocket(5)---多人聊天系统

    多人聊天系统 功能说明:多人聊天系统,主要功能点: 1.当你登陆成功后,可以看到所有在线用户(实际开发可以通过redis实现,我这边仅仅用map集合) 2.实现群聊功能,我发送消息,大家都可以看到. ...

  7. java代码之美(1)---Lambda

    Lambda 一.概述 1.什么是Lambda表达式 Lambda 表达式是一种匿名函数,简单地说,它是没有声明的方法,也即没有访问修饰符.返回值声明和名字. 它可以写出更简洁.更灵活的代码.作为一种 ...

  8. MyBatis 分页插件 PageHelper 使用

    1.  引入Maven依赖 <?xml version="1.0" encoding="UTF-8"?> <project xmlns=&qu ...

  9. Spring中bean实例化的三种方式

    之前我已经有好几篇博客介绍Spring框架了,不过当时我们都是使用注解来完成注入的,具体小伙伴可以参考这几篇博客(Spring&SpringMVC框架案例).那么今天我想来说说如何通过xml配 ...

  10. .NET代码树执行时间计时器

    有很多时候我们需要对代码不同段计算一个执行时间,并希望通过节点树的方式表达现每段代码的执行时长.在.Net下似乎找不到这样一个功能类,所以花了一些时间实现这样一个代码运行计时器.首先看一下简单的需求. ...