Django Runserver Does Not Respond When Opened In The Browser
Solution 1:
Give it a try with binding to all of the network interfaces:
python manage.py runserver [::]:8000
You should be able to see what port it is listening on. Go to START, and type cmd
. Right click cmd
and Run As Administrator. Then type:
netstat
Do you see anything in that list like?
TCP 0.0.0.0:8000 YourPC-PC:0 LISTENING
That would be the listing of the Django runserver in your network ports list.
Solution 2:
Try restarting your computer.
Same thing happened to me on my Windows 10 machine while debugging multiple APIs running locally on flask dev server and accessing them with my Django webapp. Closing and restarting the Django server didn't help as it showed no errors on the console while the webapp page still won't load. Doing a restart eliminates this problem that may have been caused by multiple servers running and restarting while in the process of debugging.
Note: Make sure to do a restart and not a regular shutdown since fast boot is enabled by default as of Windows 8. Else, it will just load the previous state of your system and the problem will persist.
Solution 3:
try following the following steps:
first find the process running on port 8000 by command:
netstat -tulpn | grep8000
take the pid and kill it using command
kill pid
run python server using command
python manage.py runserver 0.0.0.0:8000
Solution 4:
Try this with 0.0.0.0
if you are running in remote server.
python manage.py runserver 0.0.0.0:8000
If not, check whether port is listening.
sudo nmap -sT -O localhost #to install=> sudo apt-get install nmap
For windows
>netstat -a -b
Solution 5:
If it helps with anyone. I came across with this problem also running on Windows, restarting Django didn't seem to help. However, when I looked at Task Manager, there seem to be other old python process running. After I killed those process, and restarted Django, it starts working.
Post a Comment for "Django Runserver Does Not Respond When Opened In The Browser"