I have a web app I'm developing locally, part of the app uses cryptocompare.
Contrarily to my previous experience on using API in Django(because previously I've been able to get data from cryptocomapare through there API), I couldn't even print the data to the console, not to talk of template.
I have even checked different other means of doing this in python on YouTube and blogs, but I don't seem to miss anything too (at least as far as I'm concerned, but technically speaking something is wrong).
I have the app in the settings/installed-app.
I have my API key linked accordingly (at least as far as I can understand).
I have done the following to create the app in Django:
The crypto code is like this for Django:
import requests
def cryptos(request):
api_rqt = requests.get(
'https://min-api.cryptocompare.com/data/v2/news/?lang=EN&api_key={my-app-key)')
api = json.loads(api_rqt.content)
print(api_rqt)
context = {'api': api}
template = 'home.html'
return render(request, template, context)
<div>
{% for api in api.Data%}
<h4>{{api.title}}</h4>
<h5>By <label>|</label> <i>{{api.published_on}}</i></h5>
<p>{{api.body}}</p>
Read More ...
{% endfor %}
</div>
I expect the output to show me news summary from cryptocompare but nothing is shown. And my Django server is running very well.
I received some exception message:
Traceback (most recent call last):
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[27/Aug/2019 10:46:30] "GET /favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 53817)
Traceback (most recent call last):
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\python-web-works\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
super().handle_error()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "c:\users\timilehin\appdata\local\programs\python\python37\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:\users\timilehin\appdata\local\programs\python\python37\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\python-web-works\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
self.handle_one_request()
File "C:\python-web-works\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\python-web-works\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
super().close()
File "c:\users\timilehin\appdata\local\programs\python\python37\Lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
If I look at that data, then what you actually want to pass to the html template is :
context = {'api': api['Data']}
This is then a list of dictionaries that you can iterate over using:
{% for dict in api %}
You can then find the fields you want.
Alternatively, look at flattening the dictionaries to only the fields you want before passing everything as the context.
Related
I am completely new to Django/python so excuse any wrong vocabulary.
I have a Django based application that has been running perfectly on the HTTP protocol in an Ubuntu server. (Django is used both as App server and webserver here) I was asked to migrate the application from HTTP to the HTTPS protocol.
I have performed the below steps in the server.
Installed the following packages:
django-extensions, django-secure, and django-sslserver
Added 'sslserver' in setting.py under INSTALLED_APPS
Placed certificate and key in /etc/ssl/certs/ and /etc/ssl/private respectively
Start-up application with the command:
python3 manage.py runsslserver --certificate /etc/ssl/certs/my.cer --key /etc/ssl/private/my.key 172.31.83.127:8081 --configuration=uat
I have updated the CLB as below: -
[CLB Listener][1]
[CLB Health Check][2]
Now, when I run the command in the server I am getting below errors: -
File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/lib/python3.5/socket.py", line 593, in write
return self._sock.send(b)
File "/usr/lib/python3.5/ssl.py", line 861, in send
return self._sslobj.write(data)
File "/usr/lib/python3.5/ssl.py", line 586, in write
return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1848)
[13/Jan/2020 17:54:54] "GET / HTTP/1.1" 500 59
Exception happened during processing of request from ('172.31.5.104', 33784)
Traceback (most recent call last):
File "/usr/lib/python3.5/wsgiref/handlers.py", line 138, in run
self.finish_response()
File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib/python3.5/wsgiref/handlers.py", line 279, in write
self._write(data)
File "/usr/lib/python3.5/wsgiref/handlers.py", line 453, in _write
result = self.stdout.write(data)
File "/usr/lib/python3.5/socket.py", line 593, in write
return self._sock.send(b)
File "/usr/lib/python3.5/ssl.py", line 861, in send
return self._sslobj.write(data)
File "/usr/lib/python3.5/ssl.py", line 586, in write
return self._sslobj.write(data)
ssl.SSLEOFError: EOF occurred in violation of protocol (_ssl.c:1848)
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/usr/lib/python3.5/wsgiref/handlers.py", line 141, in run
self.handle_error()
File "/usr/local/lib/python3.5/dist-packages/django/core/servers/basehttp.py", line 116, in handle_error
super().handle_error()
File "/usr/lib/python3.5/wsgiref/handlers.py", line 368, in handle_error
self.finish_response()
File "/usr/lib/python3.5/wsgiref/handlers.py", line 180, in finish_response
self.write(data)
File "/usr/lib/python3.5/wsgiref/handlers.py", line 274, in write
self.send_headers()
File "/usr/lib/python3.5/wsgiref/handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "/usr/lib/python3.5/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 "/usr/lib/python3.5/socketserver.py", line 625, in process_request_thread
self.finish_request(request, client_address)
File "/usr/lib/python3.5/socketserver.py", line 354, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "/usr/lib/python3.5/socketserver.py", line 681, in init
self.handle()
File "/usr/local/lib/python3.5/dist-packages/django/core/servers/basehttp.py", line 169, in handle
self.handle_one_request()
File "/usr/local/lib/python3.5/dist-packages/django/core/servers/basehttp.py", line 194, in handle_one_request
handler.run(self.server.get_app())
File "/usr/lib/python3.5/wsgiref/handlers.py", line 144, in run
self.close()
File "/usr/local/lib/python3.5/dist-packages/django/core/servers/basehttp.py", line 111, in close
super().close()
File "/usr/lib/python3.5/wsgiref/simple_server.py", line 36, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
Any help here would be really appreciated.
Thanks
I am having a problem adding amazon S3 in my Django app, and the server keeps returning "value error required parameter name not set".please I need help because I am about to quit.again take a look at the traceback url.please help me I am king of frustrated right now because of this.
ValueError at /app/
Required parameter name not set
Request Method: GET
Request URL: http://127.0.0.1:8000/app/
Django Version: 2.0.13
Exception Type: ValueError
Exception Value:
Required parameter name not set
Exception Location: C:\Python34\lib\site-
packages\boto3\resources\base.py in __init__, line 119
Python Executable: C:\Python34\python.exe
Python Version: 3.4.4
Python Path:
['C:\\Users\\Mustapha\\Desktop\\Myfirstapp',
'C:\\WINDOWS\\SYSTEM32\\python34.zip',
'C:\\Python34\\DLLs',
'C:\\Python34\\lib',
'C:\\Python34',
'C:\\Python34\\lib\\site-packages']
Server time: Wed, 11 Sep 2019 01:20:16 +0000
templates
required parameter not set:
<img src="{{Blogger.image.url}}" width="70" height="70" class="c" />
traceback:
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python34\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python34\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python34\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python34\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python34\lib\socket.py", line 398, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[11/Sep/2019 12:24:51] "GET /app/ HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 64131)
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python34\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python34\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "C:\Python34\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "C:\Python34\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python34\lib\socket.py", line 398, in write
return self._sock.send(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python34\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python34\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error
super().handle_error()
File "C:\Python34\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python34\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python34\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python34\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python34\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:\Python34\lib\socketserver.py", line 617, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python34\lib\socketserver.py", line 344, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python34\lib\socketserver.py", line 673, in __init__
self.handle()
File "C:\Python34\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle
handler.run(self.server.get_app())
File "C:\Python34\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python34\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
I'm running Django 2.17 and I get many many errors from the dev server, the terminal prints this error 5 or six times on every requestx to the dev server.
Trying to add --verbosity 0 to the runserver command does not supress them.
I want to print from functions in views, but I don't need the errors from django.
Someone on the django IRC channel told me that they were normal... but it looks as if something is not configured correctly to me.
EDITED IN:
Traceback (most recent call last):
File "c:\python\Lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "c:\python\Lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "c:\python\Lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "c:\python\Lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "c:\python\Lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "c:\python\Lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "c:\python\Lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
Traceback (most recent call last):
File "c:\python\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\python\Lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "c:\python\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\python\Lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "c:\python\Lib\socketserver.py", line 717, in __init__
self.handle()
File "c:\python\Lib\socketserver.py", line 717, in __init__
self.handle()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 151, in handle
self.handle_one_request()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 153, in handle
self.handle_one_request()
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 176, in handle_one_request
handler.run(self.server.get_app())
File "C:\Python\virtualenvs\tools\lib\site-packages\django\core\servers\basehttp.py", line 176, in handle_one_request
handler.run(self.server.get_app())
File "c:\python\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\python\Lib\wsgiref\handlers.py", line 144, in run
self.close()
File "c:\python\Lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
File "c:\python\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'
--------------------------------------------------------------------------------
Looks like you are trying to split a variable that you expect to be str but which is somehow NoneType (None) instead.
I am using Django Rest Framework for the back-end and Angular 7 for the user interface. I'm trying to create a login page to my single page application and authenticate with a jwt token. I've already managed the back-end and it works. Whenever i go to /api-token-auth/ and type the credentials i get a token in the rest framework interface.
The front-end part though troubles me. I have created the login component, the authorization service and a token interceptor. I believe i did the right adjustments but whenever i try to login from angular this error appears in the django command promt.
"Bad Request: /api-token-auth/ [19/Nov/2018 20:16:16] "POST
/api-token-auth/ HTTP/1.1" 400 68 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 332, in send_headers
self.send_preamble() File "C:\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:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data) File "C:\Python36\lib\socketserver.py", line 775, in write
self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host
machine [19/Nov/2018 20:16:16] "POST /api-token-auth/ HTTP/1.1" 500 59
---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 51566) 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 332, in send_headers
self.send_preamble() File "C:\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:\Python36\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data) File "C:\Python36\lib\socketserver.py", line 775, in write
self._sock.sendall(b) ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host
machine
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
86, in handle_error
super().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
154, 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'"
I'm really trying to understand what is going on based in this error. Anybody has an idea? Thanks
UPDATE
I had never imported the FormsModuls and apparently that was causing the issue.
line 35, in close self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
Due to some reason, the attribute self.status is returning None which cannot be split, thus, causing errors.
I have a Celery task that works with Redis:
#app.task(bind=True, name='task_a', max_retries=4, soft_time_limit_exception=300)
def task_a(self, a, b):
try:
# some code here
except Exception as e:
raise self.retry(exc=e, countdown=exponential_backoff(self))
def exponential_backoff(task_self):
minutes = task_self.default_retry_delay / 60
rand = random.uniform(minutes, minutes * 1.5)
return int(rand ** task_self.request.retries) * 60
I have the following issue:
If Redis is not working or celery workers are stopped/failed, the code is 'waiting' than continue the execution of code.
If I put try except block inside the task, or the task called inside try except, it cathches nothing, I get a ConnectionAbortedError.
What I want in this cases, is to catch this specific errors and do other operations, or ignore without calling retry.
#Pavel Minenkov answer suggest to use sentry.io, but the issue is that I don't know were to catch it.
See Traceback:
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 49301)
Traceback (most recent call last):
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 332, in send_headers
self.send_preamble()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 255, in send_preamble
('Date: %s\r\n' % format_date_time(time.time())).encode('iso-8859-1')
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 453, in _write
result = self.stdout.write(data)
File "D:\DevEnv\Python\lib\socketserver.py", line 796, in write
self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "D:\DevEnv\PythonVENV\DjangoDev\lib\site-packages\django\core\servers\basehttp.py", line 86, in handle_error
super().handle_error()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "D:\DevEnv\Python\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 "D:\DevEnv\Python\lib\socketserver.py", line 647, in process_request_thread
self.finish_request(request, client_address)
File "D:\DevEnv\Python\lib\socketserver.py", line 357, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "D:\DevEnv\Python\lib\socketserver.py", line 717, in __init__
self.handle()
File "D:\DevEnv\PythonVENV\DjangoDev\lib\site-packages\django\core\servers\basehttp.py", line 154, in handle
handler.run(self.server.get_app())
File "D:\DevEnv\Python\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "D:\DevEnv\Python\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
First of all implement monitoring system. I like Sentry: https://sentry.io/welcome/ It is free for 1 user
from raven import Client
...
#app.task(bind=True, name='task_a', max_retries=4, soft_time_limit_exception=300)
def task_a(self, a, b):
sentry = Client(dsn=<your>)
with sentry.capture_exceptions():
# some code here
Then you will be able found out what Exception(s) are raises, then you will able to workaround the issue