Django 报错总结
报错: AttributeError: 'NoneType' object has no attribute 'split'
最近在写网站中遇到一个问题,就是题目上所写的:AttributeError: 'NoneType' object has no attribute 'split' 然后还有这样一行代码:self.status.split(' ',1)[0], self.bytes_sent ,大致意思就是说:返回的值是NoneType,split会报错?这里暂时先放着,不是很熟悉。这个问题困惑了我一天,怎么都想不到办法解决。
网上查到一个方法,因为我是写ajax代码时出现的这个问题,在ajax代码中加上'async' : false,这一行,表示不使用异步。当时有点疑惑,写ajax不就是为了异步吗?试着看能不能解决问题,果然可以。好吧就这样。。。但是浏览器返回了一个建议:“Synchronous XMLHttpRequest on the main thread is deprecated because of its detrimental effects to the end user’s experience”,有道翻译就是“不建议在主线程上使用同步XMLHttpRequest,因为它会对最终用户的体验产生有害影响”。
然后写到最后的时候,突然想到,我的js代码是从form表单中获取数据,当提交数据的时候默认的是form表单提交,得阻止默认的form表单提交,不然就会出现题目中的错误。所以js代码中写点击事件的时候,要注意是不是form表单里面提交:
xxxxBtn.click(function (event) {
event.preventDefault();
......
}
这样就不会报错了。
Django 报错总结的更多相关文章
- Django报错:OSError: raw write() returned invalid length 4 (should have been between 0 and 2)
在使用Django时Django报错:Django报错:OSError: raw write() returned invalid length 4 (should have been between ...
- Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and you have APPEND_SLASH set.
Django报错:提交表单报错---RuntimeError: You called this URL via POST, but the URL doesn’t end in a slash and ...
- django 报错Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: ['$post/(?P<pk>[0-9]+)/$']
Django报错:Reverse for 'detail' with keyword arguments '{'pk': '2'}' not found. 1 pattern(s) tried: [' ...
- Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name.
Django 报错 Reverse for 'content' not found. 'content' is not a valid view function or pattern name. 我 ...
- ubuntu pip 安装django报错解决
系统版本 ubuntu Kylin 16.04 LTS 安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...
- 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure
报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...
- 记一次Django报错Reverse for 'indextwo' with no arguments not found. 1 pattern(s) tried: ['$index/$']
启动python manage.py runserver 打开127.0.0.1:8000,报错信息如下: Reverse for 'indextwo' with no arguments not f ...
- 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 ...
- django报错解决:Invalid HTTP_HOST header: 'xxx.com'. You may need to add u'xxx.com' to ALLOWED_HOSTS.
django版本:1.11.15 使用uwsgi+nginx运行django程序,出现报错,报错为:Invalid HTTP_HOST header: 'xxx.com:82'. You may ne ...
- django报错:django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module. Did you install mysqlclient?
django 迁移数据库报错 django.core.exceptions.ImproperlyConfigured: Error loading MySQLdb module.Did you ins ...
随机推荐
- typeScript模块<一>
/*模块 模块的的概念 模块导出的几种方法 1.export 导出声明 2.export 导出语句 3.export default 4.import导入模块 模块化封装上一讲的DB库 */ /* 模 ...
- Netty服务器连接池管理设计思路
应用场景: 在RPC框架中,使用Netty作为高性能的网络通信框架时,每一次服务调用,都需要与Netty服务端建立连接的话,很容易导致Netty服务器资源耗尽.所以,想到连接池技术,将与同一个Nett ...
- 获取IFC构件的位置数据、方向数据
获取IFC构件的位置数据.方向数据 std::map<int, shared_ptr<BuildingEntity>> map_buildingEntity = b_model ...
- SqStack进制计算
基于SqStack 进制计算 #include<malloc.h> #include<stdio.h> #include<stdlib.h> typedef int ...
- c# list 使用Where()方法过滤数据
//根据任务id过滤数据 Func<RfidCodeResultDto, bool> expression = c => c.lineTaskId == _lineTaskId; r ...
- 算法习题---5-2Ducci序列(UVa1594)
一:题目 对于一个n元组(a1, a2, …, an),可以对于每个数求出它和下一个数的差的绝对值,得到一个新的n元组(|a1-a2|, |a2-a3|, …, |an-a1|).重复这个过程,得到的 ...
- xshell连接中标麒麟
中标麒麟: 1.首先肯定需要给虚拟机配置静态ip,让虚拟机作为独立的ip存在 https://www.cnblogs.com/judes/p/11776872.html 2.输入rpm -qa | g ...
- Linq中demo,用力看看吧
本文导读:LINQ to SQL全称基于关系数据的.NET语言集成查询,用于以对象形式管理关系数据,并提供了丰富的查询功能.Linq中where查询与SQL命令中的Where作用相似,都是起到范围限定 ...
- 【GStreamer开发】GStreamer基础教程06——媒体格式和pad的Capabilities
目标 Pad的Capabilities是一个GStreamer element的基础,因为framework大部分时间是自动处理的,所以我们几乎感觉不到它的存在.本教程比较偏向原理,介绍了 ...
- Terence’s Stuff: Why do we do research?
This sound like a question best answered via a survey conducted by a body such as Vitae, an internat ...