报错: 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 报错总结的更多相关文章

  1. 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 ...

  2. 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 ...

  3. 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: [' ...

  4. 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. 我 ...

  5. ubuntu pip 安装django报错解决

    系统版本 ubuntu  Kylin 16.04 LTS       安装pip3 安装 Django 总是提示time out,无法安装. 逛了好多论坛终于遭到了解决办法,分享保存: sudo pi ...

  6. 关于Django报错django.core.exceptions.ImproperlyConfigured: Requested setting DEBUG, but settings are not configure

    报错代码:django.core.exceptions.ImproperlyConfigured: Requested setting DEFAULT_INDEX_TABLESPACE, but se ...

  7. 记一次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 ...

  8. 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 ...

  9. 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 ...

  10. 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 ...

随机推荐

  1. (转)设置了RemoveIPC=yes 的RHEL7.2 会crash掉Oracle asm 实例和Oracle database实例

    设置了RemoveIPC=yes 的RHEL7.2  会crash掉Oracle asm 实例和Oracle database实例,该问题也会在使用Shared Memory Segment (SHM ...

  2. leetcode 11. Container With Most Water 、42. Trapping Rain Water 、238. Product of Array Except Self 、407. Trapping Rain Water II

    11. Container With Most Water https://www.cnblogs.com/grandyang/p/4455109.html 用双指针向中间滑动,较小的高度就作为当前情 ...

  3. Docs-.NET-C#-指南-语言参考-关键字-值类型:char

    ylbtech-Docs-.NET-C#-指南-语言参考-关键字-值类型:char 1.返回顶部 1. char(C# 参考) 2019/10/22 char 类型关键字是 .NET System.C ...

  4. CDH 部署 Hadoop:5.开始安装

    Cloudera Enterprise 6.2.x   或者参考https://blog.csdn.net/shawnhu007/article/details/52579204 第零步:优化相关 e ...

  5. mobile crane 1

    void MobileCrane::rotateRope2() { //double r_angle1 = rotateRope + rorate3; //std::cout << &qu ...

  6. Windows下MariaDB数据库安装图文教程

    MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQL数据库可以迁移到MariaDB中使用   说明: MariaDB是基于MySQL的开源数据库,兼容MySQL,现有的MySQ ...

  7. Linux记录-史上最全的MySQL高性能优化实战总结(转载)

       史上最全的MySQL高性能优化实战总结! 1.1 前言 MySQL对于很多Linux从业者而言,是一个非常棘手的问题,多数情况都是因为对数据库出现问题的情况和处理思路不清晰.在进行MySQL的优 ...

  8. 报错 react-hot-loader

    ./node_modules/element-react/dist/npm/es5/libs/animate/index.js Module not found: Can't resolve 'rea ...

  9. Python初级 3 基本数学运算

    一. 四大基本运算操作符 1 加+ print(3 + 2) 2 减- print(3 - 2) 3 乘:* print(3 * 2) 4 除/, // print(3 / 2) print(3 // ...

  10. DBGrid中插入DateTimePicker

    DateTimePicker inside a DBGrid Here's how to place a TDateTimePicker into a DBGrid. Create visually ...