0

If you look at first few lines you will understand that bootstrap.min.css is linked and is accessed easily with no error. The error line starts with Favicon.ico not being available.

Starting of Error: enter image description here

The mark 1 in the image is when i open the localhost:8000. I added favicon.ico and related icons in the main directory But no luck. Ask for the things you require ...i'll reply as soon as possible.

I have tried searching online and there is nothing i can find related to error which starts like this. After a few reloads of webpage the error stops appearing and the servers works normally.

UPDATE 1:

enter image description here

I have all requirements complete as bootstrap is working.

UPDATE 2: The Error only appears when the request is sent for the first time but when i reload the page by pressing reload button on browser or F5 key , the error is not shown on the server CMD Window. Conclusion: The error only shows up when i open a new tab and re enter the URL localhost:8000 but when reloading the server works normally. Error log:

[20/Jun/2019 15:57:15] "GET /static/css/bootstrap.min.css HTTP/1.1" 200 140936
Not Found: /favicon.ico
[20/Jun/2019 15:57:16] "GET /favicon.ico HTTP/1.1" 404 2362
Traceback (most recent call last):
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 332, in send_headers
    self.send_preamble()
  File "C:\Users\Asus\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\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 799, in write
    self._sock.sendall(b)
ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine
[20/Jun/2019 15:57:16] "GET /favicon.ico HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 59289)
Traceback (most recent call last):
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 138, in run
    self.finish_response()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 332, in send_headers
    self.send_preamble()
  File "C:\Users\Asus\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\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 453, in _write
    result = self.stdout.write(data)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 799, 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\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 141, in run
    self.handle_error()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 116, in handle_error
    super().handle_error()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 368, in handle_error
    self.finish_response()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 180, in finish_response
    self.write(data)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 274, in write
    self.send_headers()
  File "C:\Users\Asus\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\Asus\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\Asus\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 650, in process_request_thread
    self.finish_request(request, client_address)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 360, in finish_request
    self.RequestHandlerClass(request, client_address, self)
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\socketserver.py", line 720, in __init__
    self.handle()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 171, in handle
    self.handle_one_request()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 194, in handle_one_request
    handler.run(self.server.get_app())
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\wsgiref\handlers.py", line 144, in run
    self.close()
  File "C:\Users\Asus\AppData\Local\Programs\Python\Python37\lib\site-packages\django\core\servers\basehttp.py", line 111, in close
    super().close()
  File "C:\Users\Asus\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'
Dushyant Deshwal
  • 388
  • 4
  • 17
  • this is more like warning is this stopping your server? – Yugandhar Chaudhari Jun 20 '19 at 11:08
  • @YugandharChaudhari No, this didn't stop the server after a few reload showing error ,the error disappears and server works normally. – Dushyant Deshwal Jun 20 '19 at 11:27
  • I am thinking that server is working normally accessing files it should be accessing but few of the error we see in this cause the same procedure to stop abruptly. This One : ConnectionAbortedError: [WinError 10053] An established connection was aborted by the software in your host machine I don't have much knowledge of handling such complex errors or python with django in general. – Dushyant Deshwal Jun 20 '19 at 11:46

1 Answers1

0

Solved it.. As mentioned the in the error log ,server tries to get favicon.ico. I put the same in the BASE Directory but that didn't help.


So I added another folder inside the already existing static folder in base directory. BaseDirectory>static>img , img (Just the name of folder for images,not a keyword).In img folder I added the favicon.ico and removed it from base directory.


Now I have another folder to add to STATICFILES_DIR in settings.py . Just add

os.path.join(BASE_DIR, 'img'),

to STATICFILES_DIR


Now link the same favicon.ico in your html files. I have base.html file that extends to other html files so i just added a line in base.html which applied to whole website. Add:

<link rel="shortcut icon" href="{% static 'img/favicon.ico' %}">

to <head> tag.

I'll mark this as answered thanks for the help ! If you find any other way let me know and post another answer.

Dushyant Deshwal
  • 388
  • 4
  • 17