报错场景

social_django 组件对原生 django 的支持较好, 但是因为 在此DRF进行的验证为 JWT 方式 和 django 的验证存在区别,

因此需要进行更改自行支持 JWT 方式的验证信息的加入

更改后再验证第三方登录时发生如下报错

详细报错

[29/Apr/2019 15:12:02] "GET / HTTP/1.1" 200 6992
[29/Apr/2019 15:12:11] "GET /login/weibo/ HTTP/1.1" 302 0
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 302 0
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__
return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256)
[29/Apr/2019 15:12:13] "GET /complete/weibo/?state=cpNja8cxhyV9GPSKvjVfWnwogNskNjob&code=ba1e4f6fd32f32d0b57094eecd0e7d1b HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 11977)
Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python36\lib\wsgiref\headers.py", line 142, in __bytes__
return str(self).encode('iso-8859-1')
UnicodeEncodeError: 'latin-1' codec can't encode characters in position 251-253: ordinal not in range(256) During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "C:\Python36\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 88, in handle_error
super(ServerHandler, self).handle_error()
File "C:\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python36\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python36\lib\wsgiref\handlers.py", line 344, in client_is_modern
return self.environ['SERVER_PROTOCOL'].upper() != 'HTTP/0.9'
TypeError: 'NoneType' object is not subscriptable During handling of the above exception, another exception occurred: Traceback (most recent call last):
File "C:\Python36\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python36\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python36\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Python36\lib\site-packages\django\core\servers\basehttp.py", line 155, in handle
handler.run(self.server.get_app())
File "C:\Python36\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python36\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------

解决方式

姑且这样子可以解决, 但是不知道这样会不会造成不好的影响

AttributeError: 'NoneType' object has no attribute 'split' 报错处理的更多相关文章

  1. python3 AttributeError: 'NoneType' object has no attribute 'split'

    from wsgiref.simple_server import make_server def RunServer(environ, start_response): start_response ...

  2. 解决AttributeError: 'Ui_MainWindow' object has no attribute 'show'报错

    1.首先使用pyqt designer来设计ui界面,将其保存为"***.ui"文件, 然后进入到pyqt所在的文件目录中,执行cmd中命令,即在当前目录中可以生成相应的**.py ...

  3. django' 前端 self.status.split(' ',1)[0], self.bytes_sent AttributeError: 'NoneType' object has no attribute 'split'

    form 表单 post之后 ,重新定向当前页面的get请求 这是因为,form表单提交的时候,按钮在form表单里面

  4. Keras AttributeError 'NoneType' object has no attribute '_inbound_nodes'

    问题说明: 首先呢,报这个错误的代码是这行代码: model = Model(inputs=input, outputs=output) 报错: AttributeError 'NoneType' o ...

  5. AttributeError: 'NoneType' object has no attribute 'extend'

    Python使用中可能遇到的小问题 AttributeError: 'NoneType' object has no attribute 'extend' 或者AttributeError: 'Non ...

  6. python提示AttributeError: 'NoneType' object has no attribute 'append'【转发】

    在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...

  7. python提示AttributeError: 'NoneType' object has no attribute 'append'

    在写python脚本时遇到AttributeError: 'NoneType' object has no attribute 'append' a=[] b=[1,2,3,4] a = a.appe ...

  8. pyspark AttributeError: 'NoneType' object has no attribute 'setCallSite'

    pyspark: AttributeError: 'NoneType' object has no attribute 'setCallSite' 我草,是pyspark的bug.解决方法: prin ...

  9. 解决opencv:AttributeError: 'NoneType' object has no attribute 'copy'

    情况一: 路径中有中文,更改即可 情况二:可以运行代码,在运行结束时显示 AttributeError: 'NoneType' object has no attribute 'copy' 因为如果是 ...

随机推荐

  1. DSAPI QQ用户相关

    获取指定QQ号头像 Label1.Image=DSAPI.QQ用户相关.下载QQ头像("20353841") 获取指定QQ群头像 Label1.Image = DSAPI.QQ用户 ...

  2. 前端性能核对表Checklist-2018

    前端性能核对表Checklist-2018 1. 计划与度量 Get Ready: Planning and Metrics ☐ Establish a performance culture. ☐ ...

  3. revit融合

    解决了嵌入部分也会布置砖胎膜或土方问题 1.需根据板往相应方向拉伸,创建拉伸体(非实例) 2.根据轮廓创建融合体 3.将两个物体融合 //创建平面 //创建草图平面,文档必须是族文档 Plane pl ...

  4. windows如何安装memcached

    官网上并未提供 Memcached 的 Windows 平台安装包,我们可以使用以下链接来下载,你需要根据自己的系统平台及需要的版本号点击对应的链接下载即可: 32位系统 1.2.5版本:http:/ ...

  5. 我的Spring Boot学习记录(一):自动配置的大致调用过程

    1. 背景 Spring Boot通过包管理工具引入starter包就可以轻松使用,省去了配置的繁琐工作,这里简要的通过个人的理解说下Spring Boot启动过程中如何去自动加载配置. 本文中使用的 ...

  6. 前端开发中使用mac自带apache服务

    场景 前端开发中,总是会有这样的需求,就是快速的写一个脚本,或者一个简单的demo页面.这时,我们需要马上可以启动一个web服务,来支持开发. 我们可以安装一个全局的cli工具,通过node服务来满足 ...

  7. [笔记]记录原开发工作在base命名空间下扩展的属性与方法

    前言 该笔记只是为了记录以前开发使用的方式. 处理命名空间namespace /** * 处理命名空间 * @param {string} 空间名称,可多个 * @return {object} 对象 ...

  8. Spring boot 入门(四):集成 Shiro 实现登陆认证和权限管理

    本文是接着上篇博客写的:Spring boot 入门(三):SpringBoot 集成结合 AdminLTE(Freemarker),利用 generate 自动生成代码,利用 DataTable 和 ...

  9. SSM框架多数据源和AOP事务管理之间

  10. canvas动态图标

    前言 canvas 强大的功能让它成为了 HTML5 中非常重要的部分,至于它是什么,这里就不需要我多作介绍了.而可视化图表,则是 canvas 强大功能的表现之一. 现在已经有了很多成熟的图表插件都 ...