我正在与Django合作开发一个网站,我和一个非开发人员团队合作,我希望每周向他们展示我的进展,但是在部署内容时我不得不花费大量的时间和精力。我的本地开发服务器到生产服务器太多了。
作为解决方案,我在家用服务器计算机(W 8.1)中安装了Django并执行了以下操作:
已禁用Windows防火墙
使用
启动django dev服务器python manage.py runserver 0.0.0.0:80和端口8000相同但不能同时使用。
这允许我从网络中的其他计算机访问该站点,但每当我尝试通过其公共IP地址访问它时,我在Django控制台中收到以下错误消息:
Traceback (most recent call last):
----------------------------------------
File "C:\Python27\lib\SocketServer.py", line 595, in process_request_thread
Exception happened during processing of request from ('192.168.1.1', 5027)
self.finish_request(request, client_address)
----------------------------------------
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python27\lib\SocketServer.py", line 651, in __init__
self.handle()
File "C:\Python27\lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
Traceback (most recent call last):
File "C:\Python27\lib\SocketServer.py", line 595, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python27\lib\SocketServer.py", line 334, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 129, in __init__
super(WSGIRequestHandler, self).__init__(*args, **kwargs)
File "C:\Python27\lib\SocketServer.py", line 651, in __init__
self.handle()
File "C:\Python27\lib\wsgiref\simple_server.py", line 116, in handle
self.raw_requestline = self.rfile.readline()
File "C:\Python27\lib\socket.py", line 447, in readline
data = self._sock.recv(self._rbufsize)
error: [Errno 10054] An existing connection was forcibly closed by the remote host
我查了一下错误,但我得到的是当服务器和客户端无法就哪种通信方式达成一致时会发生此错误。我该如何解决这个问题?