Errors running/starting django project
Hey guys,
I'm following a Django course online, but I'm constantly running into errors right after starting the project, and running out of solutions to fix it...
Whenever I create/start a django project in PyCharm, and run it in PyCharm right after its created to see whether there are any errors, I get the following messages:
"C:\Program Files (x86)\JetBrains\PyCharm 2016.3.2\bin\runnerw.exe" C:\Python\Python36-32\python.exe C:/Users/marks/OneDrive/PyCharm/HomeSite/manage.py runserver 8000
Performing system checks...
System check identified no issues (0 silenced).
January 15, 2017 - 09:51:46
Django version 1.10.5, using settings 'HomeSite.settings'
Starting development server at http://127.0.0.1:8000/
Quit the server with CTRL-BREAK.
Up to this point I don't get any error, but the moment I load http://127.0.0.1:8000/, the following errors appends in the log:
[15/Jan/2017 09:53:06] "GET / HTTP/1.1" 200 1767
----------------------------------------
Exception happened during processing of request from ('127.0.0.1', 50546)
Traceback (most recent call last):
File "C:\Python\Python36-32\lib\socketserver.py", line 639, in process_request_thread
self.finish_request(request, client_address)
File "C:\Python\Python36-32\lib\socketserver.py", line 361, in finish_request
self.RequestHandlerClass(request, client_address, self)
File "C:\Python\Python36-32\lib\socketserver.py", line 696, in __init__
self.handle()
File "C:\Python\Python36-32\lib\site-packages\django\core\servers\basehttp.py", line 159, in handle
self.raw_requestline = self.rfile.readline(65537)
File "C:\Python\Python36-32\lib\socket.py", line 586, in readinto
return self._sock.recv_into(b)
ConnectionResetError: [WinError 10054] An existing connection was forcibly closed by the remote host
----------------------------------------
What is even more confusing is when I try to run the server from a simple cmd prompt and load the page, I dont get ANY errors.
I get the feeling "C:\Program Files (x86)\JetBrains\PyCharm 2016.3.2\bin\runnerw.exe" is causing the problem, I've never seen that run before "python manage.py runserver" before and I cant find a reference to runnerw in settings anywhere.
Another thing that confuses me: Exception happened during processing of request from ('127.0.0.1', 50546)
What request is being sent from port number 50546 and why does it raise an error in PyCharm, but not in cmd?
os: Windows 10
Python: 3.6 (also on version 3.5.1)
Django: 1.10.5
Anybody got an idea?
Greets, Mark
UPDATE:
Each an every time I load a page from the server, another section appends to the log, but every time it has a different port number (50567, 50577, 50589, 50615).
By the way, I haven't mentioned it before, but I've already reinstalled python 3 times, each and every time python is installed, its installed with admin privileges.
UPDATE2:
Now im also getting errors in the CMD prompt after starting the server and loading the page...
UPDATE3:
I've uninstalled python and installed Anaconda3 to see if that made a difference.
At first I thought it did, since it kept running without (unusual) errors. But now I've rebooted, restarted PyCharm and tried to start the server that way, and once again the same error popped up...
I depleted my toolbox, so if anyone has an idea or solution, I would greatly appreciate the help.
Please sign in to leave a comment.
Hello.
``runnerw.exe`` is part of PyCharm. It is used to handle CTRL+C and other signals gracefully on windows. You can simply delete it from ``[PYCHARM_LOCATION]\bin``, restart PyCharm and check again to see if it works.
I believe 50546 is port used by your browser. In TCP each part has its own port. Server has 8080 and client port chosen randomly. For some reason client (your browser) closed connection while Django was trying to write something to it.
Next step (if deleting runnerw wouldn't help) is to debug conversation between server and client. Local connections can't be sniffed in Windows, so you can use tool like https://www.charlesproxy.com/
I can give you instruction is you want, but please start with deleting runnerw.
You also can create issue (https://youtrack.jetbrains.com) describing your PyCharm, JDK, Windows and Python version and attaching your project, so our QA team will be able to reproduce it to help us with investigation.
Thank you.