I have had many problems in Django (not all of them solved), but this is by far the weirdest and most incomprehensible one. It happens when I load a page:
>python manage.py runserver Validating models... 0 errors found Django version 1.3.1, using settings 'ponysite.settings' Development server is running at http://127.0.0.1:8000/ Quit the server with CTRL-BREAK. [01/Nov/2011 01:21:49] "GET / HTTP/1.0" 500 102747 Traceback (most recent call last): File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 284, in run self.finish_response() File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 324, in finish_response self.write(data) File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 420, in write self._write(data) File "C:\Python27\lib\socket.py", line 324, in write self.flush() File "C:\Python27\lib\socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 10054] An existing connection was forcibly closed by the remote host ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 63095) Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock self.process_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 310, in process_request self.finish_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 570, in __init__ BaseHTTPRequestHandler.__init__(self, *args, **kwargs) File "C:\Python27\lib\SocketServer.py", line 641, in __init__ self.finish() File "C:\Python27\lib\SocketServer.py", line 694, in finish self.wfile.flush() File "C:\Python27\lib\socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 10054] An existing connection was forcibly closed by the remote host ---------------------------------------- Traceback (most recent call last): File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 284, in run self.finish_response() File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 324, in finish_response self.write(data) File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 420, in write self._write(data) File "C:\Python27\lib\socket.py", line 324, in write self.flush() File "C:\Python27\lib\socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 10054] An existing connection was forcibly closed by the remote host ---------------------------------------- Exception happened during processing of request from ('127.0.0.1', 63099) Traceback (most recent call last): File "C:\Python27\lib\SocketServer.py", line 284, in _handle_request_noblock self.process_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 310, in process_request self.finish_request(request, client_address) File "C:\Python27\lib\SocketServer.py", line 323, in finish_request self.RequestHandlerClass(request, client_address, self) File "C:\Python27\lib\site-packages\django\core\servers\basehttp.py", line 570, in __init__ BaseHTTPRequestHandler.__init__(self, *args, **kwargs) File "C:\Python27\lib\SocketServer.py", line 641, in __init__ self.finish() File "C:\Python27\lib\SocketServer.py", line 694, in finish self.wfile.flush() File "C:\Python27\lib\socket.py", line 303, in flush self._sock.sendall(view[write_offset:write_offset+buffer_size]) error: [Errno 10054] An existing connection was forcibly closed by the remote host ---------------------------------------- [01/Nov/2011 01:21:53] "GET / HTTP/1.0" 500 102391
I have tried wiping and recreating the database, stripping down views.py
and models.py
to the bare minimum to no avail. I have also tried running the same project on another computer with the same result. Both are running Windows x64. Actually, I think the one computer is running Django 1.3.x and the ther 1.2.x, but the error looks the same regardless.
Here is the full traceback:
Environment: Request Method: GET Request URL: http://127.0.0.1:8000/ Django Version: 1.3.1 Python Version: 2.7.2 Installed Applications: ['django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.sites', 'django.contrib.messages', 'django.contrib.staticfiles', 'django.contrib.admin', 'django.contrib.admindocs', 'forum', 'django.contrib.markup'] Installed Middleware: ('django.middleware.common.CommonMiddleware', 'django.contrib.sessions.middleware.SessionMiddleware', 'django.middleware.csrf.CsrfViewMiddleware', 'django.contrib.auth.middleware.AuthenticationMiddleware', 'django.contrib.messages.middleware.MessageMiddleware') Traceback: File "C:\Python27\lib\site-packages\django\core\handlers\base.py" in get_response 101. request.path_info) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in resolve 250. for pattern in self.url_patterns: File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_url_patterns 279. patterns = getattr(self.urlconf_module, "urlpatterns", self.urlconf_module) File "C:\Python27\lib\site-packages\django\core\urlresolvers.py" in _get_urlconf_module 274. self._urlconf_module = import_module(self.urlconf_name) File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module 35. __import__(name) File "C:\Users\kiwi\Dropbox\Programming Projects\Django Projects\ponysite\..\ponysite\urls.py" in 3. admin.autodiscover() File "C:\Python27\lib\site-packages\django\contrib\admin\__init__.py" in autodiscover 26. import_module('%s.admin' % app) File "C:\Python27\lib\site-packages\django\utils\importlib.py" in import_module 35. __import__(name) File "C:\Users\kiwi\Dropbox\Programming Projects\Django Projects\ponysite\forum\admin.py" in 1. from forum.models import Category, Thread, Post, Report, Subscription, Ban Exception Type: ImportError at / Exception Value: cannot import name Ban
Ban
was a model in models.py
(imported in views.py
) I played around with for a while, but it is currently commented out everywhere in my model, view, and controller. I don’t know if it has anything at all to do with the problem.
Thanks in advance, guys.