Related:
I am total new to Python and its frameworks. Just trying some hands on Django after some Python fundamentals.
Problem:
Right now I am trying to run Django server after first installation. The server runs without any error but when I try to visit the web page I get 503 Service Unavailable
Error on http://127.0.0.1:8000/
and the server shuts down automatically.
Server Runs but errors after request:
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:51:36
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
^C
D:\Code\Outer_Dir>manage.py runserver
Validating models...
0 errors found
December 23, 2013 - 21:55:21
Django version 1.6.1, using settings 'mysite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 200 1757
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
[23/Dec/2013 21:55:26] "GET / HTTP/1.1" 500 59
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58251)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\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:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
----------------------------------------
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 58252)
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 138, in run
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 333, in send_headers
self._write(bytes(self.headers))
File "C:\Python33\lib\wsgiref\handlers.py", line 453, in _write
self.stdout.write(data)
File "C:\Python33\lib\socket.py", line 317, in write
return self._sock.send(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly close
d by the remote host
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Python33\lib\wsgiref\handlers.py", line 141, in run
self.handle_error()
File "C:\Python33\lib\wsgiref\handlers.py", line 368, in handle_error
self.finish_response()
File "C:\Python33\lib\wsgiref\handlers.py", line 180, in finish_response
self.write(data)
File "C:\Python33\lib\wsgiref\handlers.py", line 274, in write
self.send_headers()
File "C:\Python33\lib\wsgiref\handlers.py", line 331, in send_headers
if not self.origin_server or self.client_is_modern():
File "C:\Python33\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:\Python33\lib\socketserver.py", line 610, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python33\lib\socketserver.py", line 345, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python33\lib\site-packages\django\core\servers\basehttp.py", line 126
, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python33\lib\socketserver.py", line 666, in __init__
self.handle()
File "C:\Python33\lib\wsgiref\simple_server.py", line 126, in handle
handler.run(self.server.get_app())
File "C:\Python33\lib\wsgiref\handlers.py", line 144, in run
self.close()
File "C:\Python33\lib\wsgiref\simple_server.py", line 35, in close
self.status.split(' ',1)[0], self.bytes_sent
AttributeError: 'NoneType' object has no attribute 'split'
来源:https://stackoverflow.com/questions/20747840/django-503-service-unavailable