美文网首页
Django项目运行时出现self.status.split('

Django项目运行时出现self.status.split('

作者: 大海龟啦啦啦 | 来源:发表于2020-08-19 09:23 被阅读0次
    Traceback (most recent call last):
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 138, in run
        self.finish_response()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
        self.write(data)
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write
        self.send_headers()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
        self.send_preamble()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
        ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 453, in _write
        result = self.stdout.write(data)
      File "C:\Program Files\Python36\lib\socketserver.py", line 775, in write
        self._sock.sendall(b)
    ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。
    [02/Nov/2018 09:46:51] "GET /new_industry/category HTTP/1.1" 500 59
    ----------------------------------------
    Exception happened during processing of request from ('127.0.0.1', 54843)
    Traceback (most recent call last):
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 138, in run
        self.finish_response()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
        self.write(data)
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write
        self.send_headers()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 332, in send_headers
        self.send_preamble()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 255, in send_preamble
        ('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 453, in _write
        result = self.stdout.write(data)
      File "C:\Program Files\Python36\lib\socketserver.py", line 775, in write
        self._sock.sendall(b)
    ConnectionAbortedError: [WinError 10053] 你的主机中的软件中止了一个已建立的连接。
    
    During handling of the above exception, another exception occurred:
    
    Traceback (most recent call last):
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 141, in run
        self.handle_error()
      File "C:\Program Files\Python36\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error
        super().handle_error()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 368, in handle_error
        self.finish_response()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 180, in finish_response
        self.write(data)
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 274, in write
        self.send_headers()
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 331, in send_headers
        if not self.origin_server or self.client_is_modern():
      File "C:\Program Files\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:\Program Files\Python36\lib\socketserver.py", line 639, in process_request_thread
        self.finish_request(request, client_address)
      File "C:\Program Files\Python36\lib\socketserver.py", line 361, in finish_request
        self.RequestHandlerClass(request, client_address, self)
      File "C:\Program Files\Python36\lib\socketserver.py", line 696, in __init__
        self.handle()
      File "C:\Program Files\Python36\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle
        handler.run(self.server.get_app())
      File "C:\Program Files\Python36\lib\wsgiref\handlers.py", line 144, in run
        self.close()
      File "C:\Program Files\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'
    

    这个错误是因为多次刷新,ajax多次进行请求,而且请求数据过大导致。ajax默认异步请求,改成同步可以解决问题。

    $.ajax({                                                       
        type: "POST",                                              
        dataType: 'json',                                          
        data: $('#data-form').serializeArray(),                    
        async: false,               //加上这一行,使之变为同步请求                           
        url: '{% url "user-login" %}',                             
        success: function (data) {                                 
            var state = data.state;                                
            if (state === 'success') {                             
                window.location.href = '{% url "homepage" %}';     
            } else {                                               
                showModel('danger', data.msg);                     
            }                                                      
        },                                                         
        error: function (data) {                                   
            console.log(data);                                     
        }                                                          
    })                                                             
    

    相关文章

      网友评论

          本文标题:Django项目运行时出现self.status.split('

          本文链接:https://www.haomeiwen.com/subject/goqrjktx.html