It has been almost a month since I got this problem, and I really appreciate your help. While trying to login in my Django Web App, i encounter OSError at /accounts/login/.I am able to login in 127.0.0.1:8000/admin, but not in the /accounts/login which produces the Error Code:
OSError at /accounts/login/
[WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
Request Method: POST
Request URL: http://127.0.0.1:8000/accounts/login/
Django Version: 1.11.1
Exception Type: OSError
Exception Value:
[WinError 10013] An attempt was made to access a socket in a way forbidden by its access permissions
Exception Location: C:\Python35-32\lib\socket.py in create_connection, line 702
Python Executable: C:\Python35-32\myvenv_python3\Scripts\python.exe
Python Version: 3.5.2
Python Path:
['C:\\Users\\Kaleab\\Desktop\\ecomstore',
'C:\\Python35-32\\lib\\site-packages\\sqlalchemy-1.1.7-py3.5-win32.egg',
'C:\\Python27',
'C:\\Python35-32\\myvenv_python3\\Lib\\site-packages',
'C:\\Python35-32',
'C:\\Users\\Kaleab\\Desktop\\ecomstore',
'C:\\Python35-32\\myvenv_python3\\Scripts\\python35.zip',
'C:\\Python35-32\\DLLs',
'C:\\Python35-32\\lib',
'C:\\Python35-32\\myvenv_python3\\Scripts',
'C:\\Python35-32\\lib\\site-packages',
'C:\\Python35-32\\lib\\site-packages\\win32',
'C:\\Python35-32\\lib\\site-packages\\win32\\lib',
'C:\\Python35-32\\lib\\site-packages\\Pythonwin']
Possible Causes and Solutions
Cause: Socket access needs administrative privilege. Attempted Solution: • Granted Administrator access to python.exe by navigating to the virtual environment. • Navigate to CMD.exe , right click , properties, grant administrator privilege.
Cause: Port can be already used by another program. Attempted Solution: Checked the ports using TCPView windows program and see that the port 8000 is not used by another program.
Cause: Socket access blocked by Firewall and Antivirus. Attempted Solution: When I tried disabling Firewall and Antivirus, I get another error ConnectionRefusedError at accounts/login/ [WinError 10061] No connection could be made because the target machine actively refused it.
Cause: Winsock has malfunctioned. Attempted Solution: Tried and successfully reset winsock, but this did not solve it either.
I will take running the server with different port as the answer, although I am not able to see port 8000 is used in stackoverflow suggested commands. Use: python manage.py runserver 8080.
Changing the port worked for me, I was trying to run the django server. Its not a firewall issue just type port in front of your command
python manage.py runserver 7000
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With